Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Adding a new command to this bot which do the following:
- include the shopping list creator into your bot
- add up the cost of your shopping
- calculate a discount
- divide the cost of a meal in a restaurant
- """
- shopping=[]
- cost=[]
- how_many_items=int(input("Add number of items in your cart "))
- for item in range(how_many_items):
- items=input("Add items: ")
- item_cost=int(input("Cost per item "+str(item)+": "))
- item+=1
- shopping.append(items)
- cost.append(item_cost)
- print("The following is the list of items added in the shopping cart: ")
- for element in shopping:
- print(element)
- print("Here are the costs for each item in the cart: ")
- for something in cost:
- print(something)
- shopping_cost=0
- index=0
- for charge in cost:
- shopping_cost=shopping_cost+cost[index]
- index+=1
- discount=0.20
- if shopping_cost>=1000:
- result=discount*shopping_cost
- else:
- pass
- print("We give you a 20 % discount",result)
- print("Your items costs",shopping_cost,"then you have to pay",shopping_cost-result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement