Sichanov

transport price

May 16th, 2021
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. kilometers = float(input())
  2. part_of_the_day = input()
  3. taxi_start_tax = 0.70
  4. taxi_day_tax = 0.79
  5. taxi_night_tax = 0.90
  6. buss_tax = 0.09         # само за разстояния минимум 20км
  7. train_tax = 0.06        # само за разстояния минимум 100км
  8.         # търсим най-ниската цена на транспорт за посочените км
  9.         # цената форматирана до втори знак
  10. price_for_transport_taxi = 0
  11. price_for_transport_buss = 0
  12. price_for_transport_train = 0
  13.  
  14. if part_of_the_day == "day":
  15.     price_for_transport_taxi = taxi_start_tax + kilometers * taxi_day_tax
  16. elif part_of_the_day == "night":
  17.     price_for_transport_taxi = taxi_start_tax + kilometers * taxi_night_tax
  18.  
  19. if part_of_the_day == "day" or part_of_the_day == "night":
  20.     price_for_transport_buss = kilometers * buss_tax
  21.     price_for_transport_train = kilometers * train_tax
  22. if kilometers < 20:
  23.     print(f"{price_for_transport_taxi:.2f}")
  24. if 20 <= kilometers < 100:
  25.     print(f"{price_for_transport_buss:.2f}")
  26. if kilometers >= 100:
  27.     print(f"{price_for_transport_train:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment