它告诉我在第19行的引文上有一个无效的语法: year = int(输入(“输入年份:”)) 而(年< 1900或年> 2100): 打印“错误超出范围。请重新输入”
我真的不知道它是什么。它说它在引号周围,但是凹痕似乎很好,也是括号。我在那里尝试了一切,但我没有任何线索
我的计划:
def isLeapYear(year):
if year % 400 == 0:
return True
elif year % 100 == 0:
return False
elif year % 4 ==0:
return True
else:
return False
def conversion(month):
conversionmonth = (month + 10) % 12
return conversionmonth
def main():
year = int(input("Enter year: "))
while (year < 1900 or year > 2100):
print"Error out of range. Please re-input"
year = int(input("Enter year: "))
if isLeapYear(year):
print "is a leap year"
else:
print "is not a leap year"
month = int(input("Enter month: "))
month = conversion(month)
while (month < 1 or month > 12)
print "Error out of range. Please re-input"
month = int(input("Enter month: ")
day = int(input("Enter day: "))
while (day < 1 or input > 31)
if month == February and day > 29:
print "Error out of range. Please re-input"
day = int(input("Enter day: ")
if isLeapYear and day > 28:
print "Error out of range. Please re-input"
day = int(input("Enter day: ")
print "Error out of range. Please re-input"
day = int(input("Enter day: ")
a = month
b = day
c = year
d = year // 100
w = (13 * a - 1) // 5
x = c // 4
y = d // 4
z = w + x + y + b + c - 2 * d
r = z % 7
r = (r + 7) % 7
if (r == 0):
print "Sunday"
if (r == 1):
print "Monday"
if (r == 2):
print "Tuesday"
if (r == 3):
print "Wednesday"
if (r == 4):
print "Thursday"
if (r == 5):
print "Friday"
if (r == 6):
print "Saturday"
main()
答案 0 :(得分:2)
在Python 3中,print
是一个函数,你必须用
print("Error out of range. Please re-input")