Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diners = []
- drink_list = []
- drink_cost = []
- starter_list = []
- starter_cost = []
- main_list = []
- main_cost = []
- side_list = []
- side_cost = []
- dessert_list = []
- dessert_cost = []
- # get diners names
- how_many = input("How many people will be eating? ")
- how_many = int(how_many)
- for diner in range(how_many):
- name = input("Who is diner number " + str(diner +1) + "? ")
- drink = input("What would you like to drink, " + name + "? ")
- starter = input("What would you like as a starter, " + name + "? ")
- main = input("What would you like for your main course, " + name + "? ")
- side = input("What would you like any side dishes with your " + main + "? ")
- dessert = input("And would you like a dessert, " + name + "? ")
- drink_price = float(input(drink + " costs £")) # this should be from a lookup table
- starter_price = float(input(starter + " costs £"))
- main_price = float(input(main + " costs £"))
- side_price = float(input(side + " costs £"))
- dessert_price = float(input(dessert + " costs £"))
- diners.append(name)
- drink_list.append(drink)
- starter_list.append(starter)
- main_list.append(main)
- side_list.append(side)
- dessert_list.append(dessert)
- drink_cost.append(drink_price)
- starter_cost.append(starter_price)
- main_cost.append(main_price)
- sides_cost.append(side_price)
- dessert_cost.append(dessert_price)
- print(diners) # confirmation - might comment out in production
- print(drink_list)
- print(drink_cost)
- print(starter_list)
- #print(starter_cost)
- #print(main_list)
- #print(main_cost)
- #print(side_list)
- #print(side_cost)
- #print(dessert_list)
- #print(dessert_cost)
- # Add all the costs together
- subtot_drinks = 0
- subtot_starters = 0
- subtot_mains = 0
- subtot_sides = 0
- subtot_desserts = 0
- Total = 0
- for i in range(how_many):
- subtot_drinks = subtot_drinks + (drink_cost[i])
- subtot_starters = subtot_starters + (starter_cost[i])
- print("The drinks cost £" +str(subtot_drinks))
- print("The starters cost £" +str(subtot_starters))
- print("The mains cost £" +str(subtot_mains))
- print("The sides cost £" +str(subtot_sides))
- print("The desserts cost £" +str(subtot_desserts))
- print()
- Total = subtot_drinks + subtot_starters + subtot_mains + subtot_sides + subtot_desserts
- print("The total cost is £" +str(Total))
- # Divide by the number of diners
- Result = Total/how_many
- print("So that's £" +str(Result) + " each.")
Advertisement
Add Comment
Please, Sign In to add comment