关于 temp.isdigit()的语法报错,小白求指导
temp = input("请输入一个年份:")whlie not temp.isdigit():
print("输入有误,",end = " ")
temp = input("请再输入一个年份:")
year = int(temp)
if (year % 4 == 0) and (year % 100 != 0) or (year % 400 == 0):
print(f"{year}是闰年。")
else:
print(f"{year}不是闰年。")
whlie not temp.isdigit():
^
SyntaxError: invalid syntax whlie not temp.isdigit():
while 的单词拼错了 while 打错了,会变色的才对
print("输入有误,",end = " ") 逗号要改为英文输入
int(temp)的括号也要改为英文输入
页:
[1]