Professional Documents
Culture Documents
Exampe1 Example2
if 1 < 2: If 2 < 2:
print("1<2") print("1<2")
print("progran ends") print("progran ends")
-------- --------
1<2 progran ends
progran ends
Exampe1
a not a
T F
Note, the not operator
F T
has higher precedence
than operator and, or
order Symbol
1 ** Exponentiation, 2**3 , 2 raised to the power 3
2 - Negation, -7
3 *, /, % Multiply, divide, remainder
4 +, - Plus, minus
5 == , !=, <, >, <=, >= comparison
6 not Logical negation
7 and, or Logical and or
8 = assignment
grade = 70
print(‘PASS’ if grade >= 60 else ‘FAIL’)
--------------------------
grade = 70
if grade >= 60:
print('PASS')
else:
print('FAIL')