# [Tutor] What's the invalid syntax?

Brian Gustin brian at daviesinc.com
Thu Apr 6 01:30:22 CEST 2006

```define year first

I.E.
year=0
int(year)
or leave the int year out of your code completely - you do not need to
typecast - it is set as an integer in the following line.

Nathan Pinno wrote:
> Hey all,
>
> What's the invalid syntax in the following code? I tried figuring it out
> by myself, and I couldn't.
>
> # This program finds the date of Easter Sunday between the years 1900 &
> 2099.
> # By Nathan Pinno
> # Inspired by Programming and Problem Solving with Java, 1st ed.,
> question 3, page 207.
> def date():
>     int year
>     year = int(raw_input("Year please: "))
>     if (year < 1900 || year > 2099):
>         print year, " is invalid. Please enter a year between 1900 & 2099."
>     else:
>         if (year == 1954 || year == 1981 || year == 2049 || year ==
> 2076): # For the years when the calculation would be 1 week late.
>             int a, b, c, d, e, f
>             a = year % 19
>             b = year % 4
>             c = year % 7
>             d = (19 * a + 24) % 30
>             e = (2 * b + 4 * c + 6 * d + 5) % 7
>             f = (22 + d + e) - 7
>             if (f < 31): # To see if the date is in March or April.
>                 print "Easter Sunday is March ", f, "."
>             else:
>                 print "Easter Sunday is April ", (f-31), "."
>         else: # For all other years.
>             int a, b, c, d, e, f
>             a = year % 19
>             b = year % 4
>             c = year % 7
>             d = (19 * a + 24) % 30
>             e = (2 * b + 4 * c + 6 * d + 5) % 7
>             f = (22 + d + e)
>             if (f < 31): # Same as above.
>                print "Easter Sunday is March ", f, "."
>             else:
>                print "Easter Sunday is April ", (f-31), "."
> date()
>
> The editor highlights the word year in the line:
>
> int year
>
> after I hit okay when this message pops up:
>
> Invalid syntax.
>
> Nathan Pinno
> Web Surfer's Store http://www.websurfstore.ca <http://www.websurfstore.ca/>
> <http://www.the-web-surfers-store.com/>
> MSN Messenger: falcon3166 at hotmail.com <mailto:falcon3166 at hotmail.com>
> Yahoo! Messenger: spam_swatter31
> ICQ: 199020705
> !DSPAM:443450a9253311285612896!
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
> !DSPAM:443450a9253311285612896!
```