1. if 条件判断
randomSet = {'Saxon', 18}
if 18 in randomSet:
print('Wow Saxon, you are so 年轻')
else:
print('impossible')
2. Loop
2.1 For loop
' loop list '
loopList = ['Saxon', 18, 'Perfect']
for item in loopList:
print(item, end=' & ') # Saxon & 18 & Perfect &
' loop number '
for num in range(0, 3):
print(num, end = ' & ') # 0 & 1 & 2 &
2.2 While loop
iterNum = 0
while iterNum < 3:
print(iterNum)
iterNum += 1
# 0
# 1
# 2
3. Pass
passList = ['ok', 'Fail']
if 'ok' in passList:
pass
else:
pass