Advertisement
horozov86

03. Fitness Card - Programming Basics Online Exam - 28 and 29 March 2020

Oct 21st, 2022
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. init_money = float(input())
  2. gender = input()
  3. age = int(input())
  4. sport = input()
  5.  
  6. price = 0
  7. if gender == "m":
  8.     if sport == "Gym":
  9.         price = 42
  10.     elif sport == "Boxing":
  11.         price = 41
  12.     elif sport == "Yoga":
  13.         price = 45
  14.     elif sport == "Zumba":
  15.         price = 34
  16.     elif sport == "Dances":
  17.         price = 51
  18.     elif sport == "Pilates":
  19.         price = 39
  20.  
  21. elif gender == "f":
  22.     if sport == "Gym":
  23.         price = 35
  24.     elif sport == "Boxing":
  25.         price = 37
  26.     elif sport == "Yoga":
  27.         price = 42
  28.     elif sport == "Zumba":
  29.         price = 31
  30.     elif sport == "Dances":
  31.         price = 53
  32.     elif sport == "Pilates":
  33.         price = 37
  34.  
  35. if age <= 19:
  36.     price = price * 0.80
  37.  
  38. diff = abs(init_money - price)
  39. if init_money >= price:
  40.     print(f"You purchased a 1 month pass for Gym.")
  41. else:
  42.     print(f"You don't have enough money! You need ${diff:.2f} more.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement