Advertisement
braconnier

shopping3-13.py

Dec 4th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. shopping_list = []
  2. cost_list = []
  3. sum = 0
  4. total = 0
  5.  
  6. how_many = input("How many items of shopping are needed ? ")
  7. how_many = int(how_many)
  8.  
  9. for items in range (how_many):
  10. items = input(" what is the item " + str(items +1 ) + " ? ")
  11. item_cost = input (" what is the cost = " )
  12. shopping_list.append(items)
  13. cost_list.append(item_cost)
  14. sum = sum + int(item_cost)
  15. average = sum/how_many
  16.  
  17. print (shopping_list)
  18. print (cost_list)
  19.  
  20. print (" I have " + str(len(shopping_list)) + " items in my shopping list")
  21.  
  22. print ("Total cost = " + str(sum))
  23.  
  24. print("Average_cost = " + str(sum)+ "/" + str(how_many) +" =" + str(average))
  25.  
  26. discount = input(" How many discount to be applied = " )
  27. discount = int(discount)
  28.  
  29. total = sum*(100-discount)/100
  30.  
  31. print ("Total with discount = " + str(total) + " Euros")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement