Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- distance_km = int(input()) # растояние за пътуване
- day_or_night = input() # дали ще пътува през деня или през ноща
- min_sum = 0.00
- taxi_day = 0.70 + distance_km * 0.79
- taxi_night = 0.70 + distance_km * 0.90
- autobus = distance_km * 0.09 # Само око растоянието е >= 20 км
- train = distance_km * 0.06 # Само ако растоянието е >= 100 км
- if distance_km < 20 and day_or_night == "day":
- print(f"{taxi_day:.2f}")
- elif distance_km < 20 and day_or_night == "night":
- print(f"{taxi_night:.2f}")
- elif 20 <= distance_km < 100 and day_or_night == "day":
- if taxi_day > autobus:
- print(f"{autobus:.2f}")
- elif taxi_day < autobus:
- print(f"{taxi_day:.2f}")
- else:
- print(f"{autobus:.2f}")
- elif 20 <= distance_km < 100 and day_or_night == "night":
- if taxi_night > autobus:
- print(f"{autobus:.2f}")
- elif taxi_night < autobus:
- print(f"{taxi_night:.2f}")
- else:
- print(f"{autobus:.2f}")
- elif distance_km >= 100 and day_or_night == "day":
- list_of_transport_day = [taxi_day, autobus, train]
- min_sum = min(list_of_transport_day)
- print(f"{min_sum:.2f}")
- elif distance_km >= 100 and day_or_night == "night":
- list_of_transport_night = [taxi_night, autobus, train]
- min_sum = min(list_of_transport_night)
- print(f"{min_sum:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement