Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Based on the Python programming assignment enterprise, define a function nonstop_destinations that takes an airport_code as a parameter and returns a list of airport objects
Based on the Python programming assignment enterprise, define a function nonstop_destinations that takes an airport_code as a parameter and returns a list of airport objects (without duplicates) that are accessible via a nonstop flight from that airport, sorting the objects in alphabetical order by airport code.
Assume that the dictionaries airport_dict, airline_dict, date_dict can be accessed within the function.
Recall the Python Programming enterprise of Airline, Airport, and Flight objects where the input data was organized into the following dictionaries: 1. airline_dict[airline_code] = Airline object 2. airport_dict[airport_code] = Airport object 3. date_dict[yyyy-mm-dd] = list of Flight objects on that date ordered by scheduled departure time Flight Airport _code: str _name: str _city: str _state: str _origin_flights: list #Flight _dest_flights: list # Flight _init__(self, con, c, s) add_origin_flight(self, flight) add_dest_flight(self, flight) _repr_(self) _date: str #yyyy-mm-dd _year: int _month: int _day: int _airline: Airline _flight_num:int _origin_airport: Airport _dest_airport: Airport _scheduled_departure: int _departure_time:int _departure_delay: int _scheduled_arrival: int _arrival_time:int _arrival_delay: int 6 getter methods: 1 for each private instance variable _init__(self, y, m, d, al, fn, oa, da, sd, dt, dd, sa, at, ad) _repr_(self) Airline _code: str _name: str _flights: list #Flight 14 getter methods: 1 for each private instance variable named: get_vname # one underscore _init__(self, c, n) add_flight(self, flight) _repr_(self) 3 getter methods: 1 for each private instance variable Recall the Python Programming enterprise of Airline, Airport, and Flight objects where the input data was organized into the following dictionaries: 1. airline_dict[airline_code] = Airline object 2. airport_dict[airport_code] = Airport object 3. date_dict[yyyy-mm-dd] = list of Flight objects on that date ordered by scheduled departure time Flight Airport _code: str _name: str _city: str _state: str _origin_flights: list #Flight _dest_flights: list # Flight _init__(self, con, c, s) add_origin_flight(self, flight) add_dest_flight(self, flight) _repr_(self) _date: str #yyyy-mm-dd _year: int _month: int _day: int _airline: Airline _flight_num:int _origin_airport: Airport _dest_airport: Airport _scheduled_departure: int _departure_time:int _departure_delay: int _scheduled_arrival: int _arrival_time:int _arrival_delay: int 6 getter methods: 1 for each private instance variable _init__(self, y, m, d, al, fn, oa, da, sd, dt, dd, sa, at, ad) _repr_(self) Airline _code: str _name: str _flights: list #Flight 14 getter methods: 1 for each private instance variable named: get_vname # one underscore _init__(self, c, n) add_flight(self, flight) _repr_(self) 3 getter methods: 1 for each private instance variableStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started