Advertisement
Guest User

Untitled

a guest
Jun 1st, 2020
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. expected_sum = int(input())
  2. command = input()
  3. total = 0
  4. sold_cash = 0
  5. sold_card = 0
  6. total_cash = 0
  7. total_card = 0
  8. while total < expected_sum:
  9.     if command == 'End':
  10.         print(f'Failed to collect required money for charity.')
  11.         break
  12.     price_per_object_cash = int(command)
  13.     price_per_object_credit_card = int(input())
  14.     if price_per_object_cash >= 100:
  15.         print(f'Error in transaction!')
  16.     else:
  17.         total += price_per_object_cash
  18.         total_cash += price_per_object_cash
  19.         sold_cash += 1
  20.         print(f'Product sold!')
  21.     if price_per_object_credit_card <= 10:
  22.         print(f'Error in transaction!')
  23.     else:
  24.         total += price_per_object_credit_card
  25.         total_card += price_per_object_credit_card
  26.         sold_card += 1
  27.         print(f'Product sold!')
  28.     if total >= expected_sum:
  29.         print(f'Average CS: {total_cash / sold_cash:.2f}')
  30.         print(f'Average CC: {total_card / sold_card:.2f}')
  31.         break
  32.     command = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement