0

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

2
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by brixton d
-1

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"

0

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 by mike_2000_17: Fixed formatting

-1

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"

Votes + Comments
double, bad indention
-1
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 by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.