Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- total_amount = int(input())
- price_subjects = input()
- sum = 0
- cash = 0
- credit_card = 0
- current = 0
- pay_cc = 0
- pay_cash = 0
- while price_subjects != "End":
- price_subjects = int(price_subjects)
- current += 1
- if current % 2 == 0:
- if price_subjects >= 10:
- credit_card += 1
- sum += price_subjects
- pay_cc += price_subjects
- print("Product sold!")
- else:
- print("Error in transaction!")
- else:
- if price_subjects <= 100:
- cash += 1
- sum += price_subjects
- pay_cash += price_subjects
- print("Product sold!")
- else:
- print("Error in transaction!")
- if sum >= total_amount:
- print(f"Average CS: {pay_cash / cash:.2f}")
- print(f"Average CC: {pay_cc / credit_card:.2f}")
- break
- price_subjects = input()
- else:
- print("Failed to collect required money for charity.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement