3

It tells me I have an invalid syntax on on the Quotation around line 19: year = int(input("Enter year: ")) while (year < 1900 or year > 2100): print"Error out of range. Please re-input"

I really don't know what it is. It says its around the quotation mark but the indents seem fine, also the parenthesis. I tried everything there but I have no clue

My Program:

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()
Michael Hawkins
  • 2,793
  • 1
  • 19
  • 33
Suliman Sharif
  • 607
  • 1
  • 9
  • 26
  • I can't really tell the indentation from this formatting, is the `print "Error"...` part indented properly under the while loop? – Michael Hawkins Jul 04 '13 at 02:02

1 Answers1

2

In Python 3, print is a function, you have to call it with something like

print("Error out of range. Please re-input")
Loïc Séguin-C.
  • 1,806
  • 2
  • 13
  • 14