Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- needed_income = int(input())
- pay_counter = 0
- cash_pay = 0
- cash_counter = 0
- card_pay = 0
- card_counter = 0
- total_sum = 0
- current_sum = 0
- while True:
- current_sum = input()
- if current_sum == "End":
- print(f"Failed to collect required money for charity.")
- break
- current_sum = int(current_sum)
- pay_counter += 1
- if pay_counter % 2 != 0:
- if current_sum > 100:
- print("Error in transaction!")
- else:
- print(f'Product sold!')
- cash_pay += current_sum
- cash_counter += 1
- if pay_counter % 2 == 0:
- if current_sum < 10:
- print('Error in transaction!')
- else:
- print(f'Product sold!')
- card_pay += current_sum
- card_counter += 1
- total_sum = cash_pay + card_pay
- if total_sum >= needed_income:
- print(f"Average CS: {cash_pay / cash_counter:.2f}")
- print(f"Average CC: {card_pay / card_counter:.2f}")
- break
Add Comment
Please, Sign In to add comment