3

Quotation の 19 行目あたりに無効な構文があることがわかります: year = int(input("Enter year: ")) while (year < 1900 or year > 2100): print"Error out of range. Please re-入力"

私はそれが何であるかを本当に知りません。引用符の周りに書かれていますが、インデントも括弧も問題ないようです。私はそこですべてを試しましたが、手がかりがありません

私のプログラム:

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()
4

1 に答える 1

2

Python 3 ではprint関数なので、次のように呼び出す必要があります。

print("Error out of range. Please re-input")
于 2013-07-04T02:06:48.673 に答える