Conditional statements
indented with four spaces
A.
N1 = INPUT ( '>>>')
IF "Alex" == "Alex":
N2 = INPUT ( '>>>')
IF == N2 "confirmation":
Print ( 'Alex SB')
the else:
Print ( 'Alex DB')
the else:
Print ( 'error')
Note:
N1 = "Alex" assignment
n1 == 'alex' comparison,
B.
IF condition. 1:
Pass
elif condition 2:
Pass
elif conditions. 3:
Pass
the else:
Pass
Print ( 'End')
C condition. 1.
and or
IF N1 == "Alex"or n2 == "alex!23":
print('OK')
else:
Print ( 'the OK')
the PS:
Pass on behalf of that empty code meaningless, merely for indicating a code block
PYthon 1day conditional statements Notes
Guess you like
Origin www.cnblogs.com/xiaomahei/p/11946772.html
Recommended
Ranking