# Grocery List Application V 1.0 Beta Edition # # Grocery.py # # By Brian Gross # # On 4/22/11 # from time import sleep import random answer = raw_input('Would you like to make a shopping list? ') name = raw_input('Enter your name ') if answer=="y" or answer=="yes" or answer=="sure" or answer=="okay": print '\a' print '\n' * 25 elif answer=="n" or answer=="no": a = 'fine!' print a.upper() exit() else: print 'Invalid command!' exit() print '\n' x = int(raw_input('How many items? ')) y = 1 while y<=x: a = raw_input('Enter an item... ') y += 1 answer_2 = raw_input('...') if answer_2 == chr(05): # Gets ASCII value 5 (ctrl - e) print name+'s','shopping list:' print a else: z = 'error ' print z.upper() sleep(2) print 'Goodbye,',name exit() exit() # http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=how+to+test+if+something+is+equal+to+an+ascii+value+in+python # # http://stackoverflow.com/questions/227459/ascii-value-of-a-character-in-python # # http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/d6b90a99-d70b-459e-8f67-7703ff242ef1/ #