soy-elparce

Menu Restaurant

Dec 18th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.52 KB | None | 0 0
  1. ######   menu.txt    ########
  2. # porotos con rienda;50;Fondo
  3. # pastel de choclo;40;Fondo
  4. # humitas;25;Aperitivo
  5. # ceviche;35;Pescado
  6. # cazuela;80;Fondo
  7. # mote con huesillo;15;Postre
  8. # empanada;15;Aperitivo
  9. # guatitas arverjadas;80;Carne
  10. # asado;120;Carne
  11.  
  12.  
  13.  
  14.  
  15.  
  16. names = []
  17. prices = []
  18. types = []
  19.  
  20. table1 = []
  21. table2 = []
  22. table3 = []
  23. table4 = []
  24. table5 = []
  25. table6 = []
  26.  
  27. def files():
  28.     try:
  29.         file = open("menu.txt","r",1,"utf-8")
  30.     except:
  31.         print("File not found")
  32.    
  33.     line = file.readline().strip()    
  34.     while line != "":
  35.         parts = line.split(";")
  36.         name = parts[0]
  37.         prrice = int(parts[1])
  38.         type = parts[2]
  39.         names.append(name)
  40.         prices.append(price)
  41.         types.append(type)
  42.        
  43.         line = file.readline().strip()
  44.        
  45. def menu():
  46.     for i in range(len(names)):
  47.         print(i+1," ",names[i], " ", prices[i], " ",types[i]," \n")
  48.            
  49. def table():
  50.     print("Put the table to serve...")
  51.     print("1)")
  52.     print("2)")
  53.     print("3)")
  54.     print("4)")
  55.     print("5)")
  56.     print("6)")
  57.     option = int(input("Put table: "))
  58.     while  option != 0:
  59.         menu()
  60.         if option == 1:
  61.             option2 = int(input("Put the id of food (0 to end): "))
  62.             while option2 != 0:
  63.                 menu()
  64.                 x = option2 - 1
  65.                 table1.append((names[x],prices[x],types[x]))
  66.                 option2 = int(input("Put the id of food (0 to end): "))
  67.         elif option == 2:
  68.             option2 = int(input("Put the id of food (0 to end): "))
  69.             while option2 != 0:
  70.                 menu()
  71.                 x = option2 - 1
  72.                 table2.append((names[x],prices[x],types[x]))
  73.                 option2 = int(input("Put the id of food (0 to end): "))
  74.         elif option == 3:
  75.             option2 = int(input("Put the id of food (0 to end): "))
  76.             while option2 != 0:
  77.                 menu()
  78.                 x = option2 - 1
  79.                 table3.append((names[x],prices[x],types[x]))
  80.                 option2 = int(input("Put the id of food (0 to end): "))
  81.                
  82.         elif option == 4:
  83.             option2 = int(input("Put the id of food (0 to end): "))
  84.             while option2 != 0:
  85.                 menu()
  86.                 x = option2 - 1
  87.                 table4.append((names[x],prices[x],types[x]))
  88.                 option2 = int(input("Put the id of food (0 to end): "))
  89.                
  90.         elif option == 5:
  91.             option2 = int(input("Put the id of food (0 to end): "))
  92.             while option2 != 0:
  93.                 menu()
  94.                 x = option2 - 1
  95.                 table5.append((names[x],prices[x],types[x]))
  96.                 option2 = int(input("Put the id of food (0 to end): "))
  97.                
  98.         elif option == 6:
  99.             option2 = int(input("Put the id of food (0 to end): "))
  100.             while option2 != 0:
  101.                 menu()
  102.                 x = option2 - 1
  103.                 table6.append((names[x],prices[x],types[x]))
  104.                 option2 = int(input("Put the id of food (0 to end): "))
  105.        
  106.        
  107.         option = int(input("Put table: "))
  108.  
  109. def main():
  110.     files()
  111.     table()
  112.    
  113. main()
  114. print("Resume of Table 1 is:\n", table1,"\n")
  115. print("Resume of Table 2 is:\n", table2,"\n")
  116. print("Resume of Table 3 is:\n", table3,"\n")
  117. print("Resume of Table 4 is:\n", table4,"\n")
  118. print("Resume of Table 5 is:\n", table5,"\n")
  119. print("Resume of Table 6 is:\n", table6,"\n")
Add Comment
Please, Sign In to add comment