Advertisement
horozov86

1.Match Tickets - Python - More Exercises

Sep 29th, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. budget = float(input())
  2. category_ticket = input()
  3. count_people = int(input())
  4.  
  5. money_transport = 0
  6.  
  7. if 1 <= count_people <= 4:
  8.     money_transport = budget * 0.75
  9. elif 5 <= count_people <= 9:
  10.     money_transport = budget * 0.60
  11.  
  12. elif 10 <= count_people <= 24:
  13.     money_transport = budget * 0.50
  14.  
  15. elif 25 <= count_people <= 49:
  16.     money_transport = budget * 0.40
  17.  
  18. elif count_people >= 50:
  19.     money_transport = budget * 0.25
  20.  
  21. if category_ticket == "VIP":
  22.     price = count_people * 499.99
  23. else:
  24.     price = count_people * 249.99
  25.  
  26. left_money = budget - money_transport
  27. diff = abs(left_money - price)
  28.  
  29. if left_money >= price:
  30.     print(f"Yes! You have {diff:.2f} leva left.")
  31. else:
  32.     print(f"Not enough money! You need {diff:.2f} leva.")
  33.  
  34.  
  35.  
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement