[Tutor] What's the invalid syntax?

Nathan Pinno falcon3166 at hotmail.com
Thu Apr 6 00:58:58 CEST 2006

```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
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
Yahoo! Messenger: spam_swatter31
ICQ: 199020705
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060405/79c94f33/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 862 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20060405/79c94f33/attachment.gif
```