Command should add new flight with the given properties.
Find: python avia.py find <From> <To>
Command should find a way from <From> airport to <To> airport for a passenger. Passenger can transfer at most once. It is always better to make no transfer, so if it is possible, find the fastest way to flight from <From> to <To> without transfer. Otherwise find the fastest way with exactly one transfer. If it is impossible too, print a message that it is impossible to travel from <From> to <To>. Your message should be pretty, for example:
Main requirements
Your program should never fail.
You are free to implement the task as you want. In particular, if there are some uncertainties, you have to decide what to do.
You are free to add some functionality. Please describe all features you added.
Implement application
avia.py
to work with avia tickets.You should store information about flights in file flights.av.
Each item has several properties:
You can assume that:
Departure < Arrival
is always true)Passengers can travel from one airport to another with transfers. But our service will provide an opportunity to make at most one transfer:
Add:
python avia.py add <From> <To> <Departure> <Arrival> <Cost>
Command should add new flight with the given properties.
Find:
python avia.py find <From> <To>
Command should find a way from
<From>
airport to<To>
airport for a passenger. Passenger can transfer at most once. It is always better to make no transfer, so if it is possible, find the fastest way to flight from<From>
to<To>
without transfer. Otherwise find the fastest way with exactly one transfer. If it is impossible too, print a message that it is impossible to travel from<From>
to<To>
. Your message should be pretty, for example:Find cheap:
python avia.py find-cheap <From> <To>
Command should find the cheapest way from
<From>
to<To>
with at most one transfer. The format of output is the same as in previous command.