svephoto

Easter Decoration [Python]

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