What's the invalid syntax?
[code]
from datetime import *
def menu():
print "(A)dd days to current date." print "(F)ind how many days have passed since a date." print "(E)xit." def menu_choice():
choice = raw_input("Enter the letter of your choice: ") return choice def date1():
y1 = int(raw_input("Enter the year: ")) m1 = int(raw_input("Enter the month: ")) d1 = int(raw_input("Enter the day: ")) date1 = date(y1, m1, d1) return date1 def date2():
y2 = int(raw_input("Enter the 2nd year: ")) m2 = int(raw_input("Enter the 2nd month: ")) d2 = int(raw_input("Enter the 2nd day: ")) date2 = date(y2, m2, d2) return date2 print "Date Calculator"
print "By Nathan Pinno" while 1: menu() menu_choice() if choice == A: date1() days = int(raw_input("Enter the number of days to add: ")) date3 = date1 + days print date(date3).isoformat(), " is the date ", days, " from today." elif choice == F: date1() date2() days = date2 - date1 print days, " days seperate " date2.isoformat(), " from ", date1.isoformat(), "." elif choice = E: break() else: print "That's not an option. Try again, please." [/code]
|
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor