Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- goal = int(input())
- product_num = -1
- sum_collect = 0
- cash_transactions = 0
- card_transactions = 0
- cash_collect = 0
- card_collect = 0
- while goal > sum_collect:
- command = input()
- product_num += 1
- if command.isnumeric():
- command = int(command)
- else:
- print('Failed to collect required money for charity.')
- break
- if command <= 100 and product_num % 2 == 0:
- sum_collect += command
- cash_collect += command
- print('Product sold!')
- cash_transactions += 1
- elif command >= 10 and product_num % 2 == 1:
- sum_collect += command
- card_collect += command
- print('Product sold!')
- card_transactions += 1
- else:
- print('Error in transaction!')
- continue
- if sum_collect >= goal:
- print(f'Average CS: {cash_collect / cash_transactions:.2f}')
- print(f'Average CC: {card_collect / card_transactions:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement