Advertisement
exDotaPro

20_april_2019_6_daster_decoration

Jan 10th, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. customers = int(input())
  2.  
  3. total_sum = 0
  4. customer_sum = 0
  5. items = 0
  6.  
  7. for i in range(customers):
  8.     customer_sum = 0
  9.     items = 0
  10.     command = input()
  11.  
  12.     while command != 'Finish':
  13.         purchase = command
  14.         items += 1
  15.  
  16.         if purchase == 'basket':
  17.             customer_sum += 1.50
  18.             total_sum += 1.50
  19.         elif purchase == 'wreath':
  20.             customer_sum += 3.80
  21.             total_sum += 3.80
  22.         elif purchase == 'chocolate bunny':
  23.             customer_sum += 7
  24.             total_sum += 7
  25.  
  26.         command = input()
  27.  
  28.         if command == 'Finish':
  29.             if items % 2 == 0:
  30.                 diff = customer_sum * 0.2
  31.                 customer_sum *= 0.8
  32.                 total_sum -= diff
  33.             print(f'You purchased {items} items for {customer_sum:.2f} leva.')
  34.             break
  35.  
  36. average_sum = total_sum / customers
  37.  
  38. print(f'Average bill per client is: {average_sum:.2f} leva.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement