Advertisement
horozov86

1.Match Tickets - Python - More Exercises

Sep 28th, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 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.  
  10. elif 5 <= count_people <= 9:
  11.     money_transport = budget * 0.60
  12.  
  13. elif 10 <= count_people <= 24:
  14.     money_transport = budget * 0.50
  15.  
  16. elif 25 <= count_people <= 49:
  17.     money_transport = budget * 0.40
  18.  
  19. elif count_people >= 50:
  20.     money_transport = budget * 0.25
  21.  
  22.  
  23. left_money = budget - money_transport
  24. all_price_vip_ticket = 499.99 * count_people
  25. all_price_normal_ticket = 249.99 * count_people
  26.  
  27. diff_vip = abs(left_money - all_price_vip_ticket)
  28. diff_normal = abs(left_money - all_price_normal_ticket)
  29.  
  30. if diff_vip >= all_price_vip_ticket:
  31.     print(f"Yes! You have {diff_vip:.2f} leva left.")
  32. else:
  33.     print(f"Not enough money! You need {diff_vip:.2f} leva.")
  34.  
  35. if diff_normal >= all_price_normal_ticket:
  36.     print(f"Yes! You have {diff_normal:.2f} leva left.")
  37. else:
  38.     print(f"Not enough money! You need {diff_normal:.2f} leva.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement