hey i would like a program to help me schedule my lectures and activities for dds. I would like to enter a date and an activity description and get as my output a text string e.g Input 03/13 work on dds assignment
Output march the 13th: work on dds assignment

def print_menu():

print '1. Add an Event'

print '2. Save Events to File'

print '3. Load Events from File'

print '4. Quit'

print

event_list = []

menu_choice = 0

print_menu()

while True:

menu_choice = input("Select Menu Item (1-4): ")

if menu_choice == 1:

print "Add Event"

date = input("Date: ")

time = raw_input("Time: ")

title = raw_input("Title: ")

desc = raw_input("Description: ")

loc = raw_input("Location: ")

attend = raw_input("Attendee(s): ")

ui = "Date: " + date, "Time: " + time, "Title: " + title, "Description: " + desc, "Location: " + loc, "Attendee(s): " + attend

event_list.append(ui)

elif menu_choice == 2:

filename = raw_input("Filename to save: ")

pickle_file = open(filename, "w")

cPickle.dump(event_list, pickle_file)

pickle_file.close()

elif menu_choice == 3:

filename = raw_input("Filename to load: ")

pickle_file = open(filename, "r")

events = cPickle.load(pickle_file)

pickle_file.close()

print "Events:", events

elif menu_choice == 4:

break

else:

print_menu()

print "Goodbye"

If you would push the (CODE) button before pasting and and would not have double spaced all code, maybe we could find out. It is not only the tags as the format shown by reply to the post shows impossible indention. Funny how similar your code seems with this python-forum post.

Edited 3 Years Ago by mike_2000_17: Fixed formatting

def print_menu():

print '1. Add an Event'

print '2. Save Events to File'

print '3. Load Events from File'

print '4. Quit'

print

event_list = []

menu_choice = 0

print_menu()

while True:

menu_choice = input("Select Menu Item (1-4): ")

if menu_choice == 1:

print "Add Event"

date = input("Date: ")

time = raw_input("Time: ")

title = raw_input("Title: ")

desc = raw_input("Description: ")

loc = raw_input("Location: ")

attend = raw_input("Attendee(s): ")

ui = "Date: " + date, "Time: " + time, "Title: " + title, "Description: " + desc, "Location: " + loc, "Attendee(s): " + attend

event_list.append(ui)

elif menu_choice == 2:

filename = raw_input("Filename to save: ")

pickle_file = open(filename, "w")

cPickle.dump(event_list, pickle_file)

pickle_file.close()

elif menu_choice == 3:

filename = raw_input("Filename to load: ")

pickle_file = open(filename, "r")

events = cPickle.load(pickle_file)

pickle_file.close()

print "Events:", events

elif menu_choice == 4:

break

else:

print_menu()

print "Goodbye"

Comments
double, bad indention
def print_menu():

print '1. Add an Event'

print '2. Save Events to File'

print '3. Load Events from File'

print '4. Quit'

print



event_list = []

menu_choice = 0

print_menu()

while True:

menu_choice = input("Select Menu Item (1-4): ")

if menu_choice == 1:

print "Add Event"

date = input("Date: ")

time = raw_input("Time: ")

title = raw_input("Title: ")

desc = raw_input("Description: ")

loc = raw_input("Location: ")

attend = raw_input("Attendee(s): ")

ui = "Date: " + date, "Time: " + time, "Title: " + title, "Description: " + desc, "Location: " + loc, "Attendee(s): " + attend

event_list.append(ui)

elif menu_choice == 2:

filename = raw_input("Filename to save: ")

pickle_file = open(filename, "w")

cPickle.dump(event_list, pickle_file)

pickle_file.close()

elif menu_choice == 3:

filename = raw_input("Filename to load: ")

pickle_file = open(filename, "r")

events = cPickle.load(pickle_file)

pickle_file.close()

print "Events:", events

elif menu_choice == 4:

break

else:

print_menu()

print "Goodbye" 

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.