Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- expected_sum = int(input())
- command = input()
- total = 0
- sold_cash = 0
- sold_card = 0
- total_cash = 0
- total_card = 0
- while total < expected_sum:
- if command == 'End':
- print(f'Failed to collect required money for charity.')
- break
- price_per_object_cash = int(command)
- price_per_object_credit_card = int(input())
- if price_per_object_cash >= 100:
- print(f'Error in transaction!')
- else:
- total += price_per_object_cash
- total_cash += price_per_object_cash
- sold_cash += 1
- print(f'Product sold!')
- if price_per_object_credit_card <= 10:
- print(f'Error in transaction!')
- else:
- total += price_per_object_credit_card
- total_card += price_per_object_credit_card
- sold_card += 1
- print(f'Product sold!')
- if total >= expected_sum:
- print(f'Average CS: {total_cash / sold_cash:.2f}')
- print(f'Average CC: {total_card / sold_card:.2f}')
- break
- command = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement