Teo_Yanchev

easter_decoration_20-21-2019_exam

Jul 17th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. customers = int(input())
  2.  
  3.  
  4. average_price = 0
  5.  
  6. for i in range(1, customers+1):
  7. command = input()
  8.  
  9.  
  10. total = 0
  11. count = 0
  12. while command != "Finish":
  13. product = command
  14.  
  15. if product == "basket":
  16. count += 1
  17. total += 1.50
  18. elif product == "wreath":
  19. count += 1
  20. total += 3.80
  21. else:
  22. count += 1
  23. total += 7
  24. command = input()
  25.  
  26. if count % 2 == 0:
  27. total *= 0.80
  28. print(f"You purchased {count} items for {total:.2f} leva.")
  29. else:
  30. print(f"You purchased {count} items for {total:.2f} leva.")
  31. average_price += total
  32. average_price = average_price / customers
  33. print(f"Average bill per client is: {average_price:.2f} leva.")
Advertisement
Add Comment
Please, Sign In to add comment