timpin

restaurant2

Aug 17th, 2019
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. diners = []
  2. drink_list = []
  3. drink_cost = []
  4. starter_list = []
  5. starter_cost = []
  6. main_list = []
  7. main_cost = []
  8. side_list = []
  9. side_cost = []
  10. dessert_list = []
  11. dessert_cost = []
  12.  
  13. # get diners names
  14. how_many = input("How many people will be eating? ")
  15. how_many = int(how_many)
  16. for diner in range(how_many):
  17. name = input("Who is diner number " + str(diner +1) + "? ")
  18. drink = input("What would you like to drink, " + name + "? ")
  19. starter = input("What would you like as a starter, " + name + "? ")
  20. main = input("What would you like for your main course, " + name + "? ")
  21. side = input("What would you like any side dishes with your " + main + "? ")
  22. dessert = input("And would you like a dessert, " + name + "? ")
  23.  
  24. drink_price = float(input(drink + " costs £")) # this should be from a lookup table
  25. starter_price = float(input(starter + " costs £"))
  26. main_price = float(input(main + " costs £"))
  27. side_price = float(input(side + " costs £"))
  28. dessert_price = float(input(dessert + " costs £"))
  29.  
  30. diners.append(name)
  31. drink_list.append(drink)
  32. starter_list.append(starter)
  33. main_list.append(main)
  34. side_list.append(side)
  35. dessert_list.append(dessert)
  36.  
  37. drink_cost.append(drink_price)
  38. starter_cost.append(starter_price)
  39. main_cost.append(main_price)
  40. sides_cost.append(side_price)
  41. dessert_cost.append(dessert_price)
  42.  
  43. print(diners) # confirmation - might comment out in production
  44. print(drink_list)
  45. print(drink_cost)
  46. print(starter_list)
  47. #print(starter_cost)
  48. #print(main_list)
  49. #print(main_cost)
  50. #print(side_list)
  51. #print(side_cost)
  52. #print(dessert_list)
  53. #print(dessert_cost)
  54.  
  55. # Add all the costs together
  56. subtot_drinks = 0
  57. subtot_starters = 0
  58. subtot_mains = 0
  59. subtot_sides = 0
  60. subtot_desserts = 0
  61. Total = 0
  62.  
  63. for i in range(how_many):
  64. subtot_drinks = subtot_drinks + (drink_cost[i])
  65. subtot_starters = subtot_starters + (starter_cost[i])
  66. print("The drinks cost £" +str(subtot_drinks))
  67. print("The starters cost £" +str(subtot_starters))
  68. print("The mains cost £" +str(subtot_mains))
  69. print("The sides cost £" +str(subtot_sides))
  70. print("The desserts cost £" +str(subtot_desserts))
  71.  
  72. print()
  73. Total = subtot_drinks + subtot_starters + subtot_mains + subtot_sides + subtot_desserts
  74. print("The total cost is £" +str(Total))
  75. # Divide by the number of diners
  76. Result = Total/how_many
  77. print("So that's £" +str(Result) + " each.")
Advertisement
Add Comment
Please, Sign In to add comment