Python 条件判断 和循环
使用条件判断 if else
# 条件派单 if else
print('条件派单 if else')
# s = input('请输入生日年号:')
# birth = int(s)
birth = 1991
if birth > 2000:
print('00后')
else:
print('00前')
使用for循环
# for 循环 print('for 循环') sum = 0 for i in range(101): sum = sum + i print("0到100的整数相加之和:", sum)
使用while循环
# while 循环 print('while 循环') n = 100 while n > 0: n = n - 1 if (n < 10): break # continue print(n)