我正在努力弄清楚如何将列表转换为整数,并在每个元素上迭代一个函数。我希望该函数检查每个元素,并需要将列表中的每个元素转换为整数。
years = ["25", "1955", "2000", "1581", "1321", "1285", "4365", "4", "1432", "3423", "9570"]
def isLeap():
year = list(map(int, years))
if year in years >= 1583:
print(year, "Is a Gregorian Calendar Year.")
elif year in years < 1583:
print(year, "Is not a Gregorian Calendar Year.")
elif year in years % 400 == 0 or year in years % 4 == 0:
print(year, "Is a Leap Year.")
elif year in years % 400 == 1 or year in years % 4 == 1:
print(year, "Is NOT a Leap Year.")
else:
print("Test cannot be performed.")
for i in years:
isLeap()
蛊毒传说
繁花不似锦
哆啦的时光机
相关分类