在没有input()
的情况下,我的功能无法正常运行,
但是当我使用input()
时,会出现错误。
year = input()
if year%4 == 0:
if year%100 == 0:
if year%400 == 0:
print("year is leap year")
else:
print("year is not a leap year")
else:
print("year is a leap year")
else:
print("year is not a leap year")
错误:
Traceback (most recent call last):
File "leapyear.py", line 2, in <module>
if year%4 == 0:
TypeError: not all arguments converted during string formatting