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