📔
Hello-Python-Tutorial
  • Preface
  • Introduction
    • What is Python?
    • Language level
    • Python can do
    • Python can not do
    • Who using Python?
  • Python Basic
    • Install Python
    • Run Python on IDLE
    • Operator/Operand
    • Data Type
    • Assignment/Variable
    • Intellij IDEA
    • First App
  • Flow Control
    • Boolean/Logic Operator
    • Relational Operator
    • Code Block
    • If/Else
    • While
    • For loop
    • Import
    • Homework
  • Function
    • First Function
    • Return Statement
    • Function Scope
    • Try/Except/finally
    • Homework
  • List and Tuple
    • List
    • List Example
    • Method
    • List-like Type
    • Reference
    • Copy Module
    • Homework
  • Dictionary
    • Dictionary
    • Method
    • Dictionary Example
    • Homework
  • String Operation
    • Escape Character
    • Raw String
    • In/Not In
    • String Method1
    • String Method2
    • Homework
  • Advance
Powered by GitBook
On this page
  • Relational Operator
  • 關係運算子
  • 範例

Was this helpful?

  1. Flow Control

Relational Operator

Relational Operator

關係運算子

關係運算子有六個

運算子
解釋
範例

==

等於

1==1

!=

不等於

2!=1

>

大於

2>1

<

小於

1<2

>=

大於等於

2>=1

<=

小於等於

1<=1

範例

print(1==1)
print(1<=1)
print('hello' == 'hello')
print('hello' == 123)
print('123' == 123)
print((1==1) and (1>=1))
PreviousBoolean/Logic OperatorNextCode Block

Last updated 2 years ago

Was this helpful?