Advertisement
simeonshopov

Report system

Oct 9th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. money_expected = int(input())
  2. cash = 0
  3. card = 0
  4. counter_cash = 0
  5. counter_card = 0
  6. counter = 1
  7. money_got = 0
  8. money = ""
  9.  
  10. while money_got != money_expected:
  11.   money = input()
  12.   if money == "End":
  13.     print("Failed to collect required money for charity.")
  14.     break
  15.    
  16.   if money != "End":
  17.     money = int(money)
  18.     if counter % 2 != 0:
  19.       if money > 100:
  20.         print("Error in transaction!")
  21.       else:
  22.         counter_cash += 1
  23.         cash += money
  24.         money_got += money
  25.         print("Product sold!")
  26.     else:
  27.       if money < 10:
  28.         print("Error in transaction!")
  29.       else:
  30.         counter_card += 1
  31.         card += money
  32.         money_got += money
  33.         print("Product sold!")
  34.        
  35.   counter += 1
  36.        
  37.   if money_got >= money_expected:
  38.     print(f"Average CS: {(cash / (counter_cash)):.2f}")
  39.     print(f"Average CC: {(card / (counter_card)):.2f}")
  40.     break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement