Advertisement
bl00dt3ars

02. Report System (2)

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