运行循环问题
请教一下 Python中怎么重复运行代码比如说 print("这是个什么年份")
temp = input("试试吧:")
while not temp.isdigit():
temp = input("整数")
a = int(temp)
if a % 4 == 0:
print(temp + "闰年")
else:
print(temp + "平年")
怎么运行完成后可以重新运行
temp = input("试试吧(按q退出):")
while temp != 'q':
while not temp.isdigit():
temp = input("整数")
a = int(temp)
if a % 4 == 0:
print(temp + "闰年")
else:
print(temp + "平年")
temp = input("试试吧(按q退出):")
谢谢指导
页:
[1]