Advertisement
bl00dt3ars

06. Easter Decoration

Nov 10th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. clients = int(input())
  2. total_purchases = 0
  3.  
  4. for i in range(clients):
  5.     purchase = input()
  6.     current_purchase = 0
  7.     basket = 0
  8.     wreath = 0
  9.     chocolate_bunny = 0
  10.     while purchase != "Finish":
  11.         current_purchase += 1
  12.         if purchase == "basket":
  13.             basket += 1
  14.         elif purchase == "wreath":
  15.             wreath += 1
  16.         else:
  17.             chocolate_bunny += 1
  18.         purchase = input()
  19.     total_sum = (basket * 1.50) + (wreath * 3.80) + (chocolate_bunny * 7)
  20.     if current_purchase % 2 == 0:
  21.         total_sum *= 0.8
  22.     total_purchases += total_sum
  23.  
  24.     print(f"You purchased {current_purchase} items for {total_sum:.2f} leva.")
  25. print(f"Average bill per client is: {total_purchases / clients:.2f} leva.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement