if 条件判断
if 判断条件:
执行代码
elif 判断条件:
执行代码
else:
执行代码
choise = True
while choise == True:
grade = int(input("请输入成绩: ").strip())
if grade == 111:
choise = False
continue
if grade >= 90:
print('优秀!')
elif grade >= 80:
print('良好!')
elif grade >= 70:
print('普通!')
else:
print('差!')
for 循环
list = [4,6,9,11]
for i in range(1,13):
for j in range(1,32):
if i in list :
if j == 31:
break
if i == 2 and j == 29:
break
print(f"{i}月{j}号")
判断是否闰年
while True:
year = int(input("输入年份: "))
if year % 100 == 0:
if year % 400 == 0:
print('是闰年!')
else:
print('不是闰年!')
elif year % 4 == 0:
print('是闰年!')
else:
print('不是闰年!')
if year == 1:
break