Advertisement
lubattillah

new command challenge

May 16th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. """
  2. Adding a new command to this bot which do the following:
  3. include the shopping list creator into your bot
  4. add up the cost of your shopping
  5. calculate a discount
  6. divide the cost of a meal in a restaurant
  7. """
  8. shopping=[]
  9. cost=[]
  10. how_many_items=int(input("Add number of items in your cart "))
  11.  
  12. for item in range(how_many_items):
  13. items=input("Add items: ")
  14. item_cost=int(input("Cost per item "+str(item)+": "))
  15. item+=1
  16. shopping.append(items)
  17. cost.append(item_cost)
  18. print("The following is the list of items added in the shopping cart: ")
  19. for element in shopping:
  20. print(element)
  21. print("Here are the costs for each item in the cart: ")
  22. for something in cost:
  23. print(something)
  24. shopping_cost=0
  25. index=0
  26. for charge in cost:
  27. shopping_cost=shopping_cost+cost[index]
  28. index+=1
  29. discount=0.20
  30. if shopping_cost>=1000:
  31. result=discount*shopping_cost
  32. else:
  33. pass
  34. print("We give you a 20 % discount",result)
  35. print("Your items costs",shopping_cost,"then you have to pay",shopping_cost-result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement