python - How to save order made by user into a file and then displaying that after the new order is made? -


this first question here , new python user. hoping regarding program.

essentially, want program act ordering service fast food. once user inputs order, i'm trying make order , username stored file , displayed later in program.

here code far:

foodmenu = {'1': 3.50, '2': 2.50, '3': 4.00, '4': 3.50,             '5': 1.75, '6': 1.50, '7': 2.25, '8': 3.75,             '9': 1.25} itemtotals = {'1': 0, '2': 0, '3': 0,'4': 0,               '5': 0, '6': 0, '7': 0, '8': 0,               '9': 0}  textfile = open("order.txt","r")  def main() :  menu()   def menu() : menu = ( """ 1. chicken strips - $3.50 2. french fries - $2.50 3. hamburger - $4.00 4. hotdog - $3.50 5. large drink - $1.75 6. medium drink - $1.50 7. milk shake - $2.25 8. salad - $3.75 9. small drink - $1.25 """ ) return menu  choices = ['1','2','3','4','5','6','7','8','9']  while true:     print(menu())  username = input("please enter name") menunumbers = input('\nenter order numbers no spaces: ') ordertotal = 0 in menunumbers:     if in choices:         ordertotal += foodmenu[i]         itemtotals[i] += 1         print("your total comes out be: ",ordertotal)          print("\nprevious customer:",username "; price of previous order was",ordertotal)        main() 

i apologize formatting if it's incorrect , aware of of issues program. (i'm stuck , lost , hoping learn of you!) thank guys!


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -