count_outgoing_Tlights(): """Return the number of outgoing flights for the airport with the iata the given routes information. >>>count_outgoing_flights('AA1', TEST_ROUTES_DICT_FOUR_CITIES) >>>count_outgoing_flights ('AA2', TEST_ROUTES_DICT_FOUR_CITIES) 2 1 return len(routes [iata]) # Complete this function (including type contract and docstring) # based on the handout description pass def count_incoming_flights(): """Return the number of incoming flights for the airport with the iata the given routes information. >>>count_incoming_flights ('AA1', TEST_ROUTES_DICT_FOUR_CITIES) >>>count_incoming_flights ('AA2', TEST_ROUTES_DICT_FOUR_CITIES) 2 1 num=0 for i in routes: if iata in routes[i]: num+=1 return num # Complete this function (including type contract and docstring) # based on the handout description

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

 

 

 def reachable_destinations(iata_src: str, n: int, routes: RouteDict) -> List[Set[str]]:
    """Return a list of the sets of airports where the set at index i is
    reachable in at most i flights. Note that iata_src will always appear at
    index 0, because it is reachable without flying anywhere.

    Precondition: n >= 0

    >>> reachable_destinations('AA1', 0, TEST_ROUTES_DICT_FOUR_CITIES)
    [{'AA1'}]
    >>> expected = [{'AA1'}, {'AA2', 'AA4'}]
    >>> result = reachable_destinations('AA1', 1, TEST_ROUTES_DICT_FOUR_CITIES)
    >>> expected == result
    True
    >>> expected = [{'AA1'}, {'AA2', 'AA4'}, {'AA3'}]
    >>> result = reachable_destinations('AA1', 2, TEST_ROUTES_DICT_FOUR_CITIES)
    >>> expected == result
    True
    """

    # Complete your function below

def count_outgoing_flights():
"""Return the number of outgoing flights for the airport with the iata in
the given routes information.
>>>count_outgoing_flights
('AA1',
TEST_ROUTES_DICT_FOUR_CITIES)
>>>count_outgoing_flights
('AA2',
TEST_ROUTES_DICT_FOUR_CITIES)
2
1
||||||
return len (routes [iata])
# Complete this function (including type contract and docstring)
#based on the handout description
pass
def count_incoming_flights():
"""Return the number of incoming flights for the airport with the iata in
the given routes information.
>>>count_incoming_flights ('AA1', TEST_ROUTES_DICT_FOUR_CITIES)
>>>count_incoming_flights ('AA2', TEST_ROUTES_DICT_FOUR_CITIES)
2
1
num=0
for i in routes:
if iata in routes [i]:
num+=1
return num
# Complete this function (including type contract and docstring)
#based on the handout description
pass
Transcribed Image Text:def count_outgoing_flights(): """Return the number of outgoing flights for the airport with the iata in the given routes information. >>>count_outgoing_flights ('AA1', TEST_ROUTES_DICT_FOUR_CITIES) >>>count_outgoing_flights ('AA2', TEST_ROUTES_DICT_FOUR_CITIES) 2 1 |||||| return len (routes [iata]) # Complete this function (including type contract and docstring) #based on the handout description pass def count_incoming_flights(): """Return the number of incoming flights for the airport with the iata in the given routes information. >>>count_incoming_flights ('AA1', TEST_ROUTES_DICT_FOUR_CITIES) >>>count_incoming_flights ('AA2', TEST_ROUTES_DICT_FOUR_CITIES) 2 1 num=0 for i in routes: if iata in routes [i]: num+=1 return num # Complete this function (including type contract and docstring) #based on the handout description pass
def count_total_flights():
# Complete this function (including type contract and docstring)
#based on the handout description
pass
def reachable_destinations (iata_src: str, n: int, routes: RouteDict) -> List [Set
"""Return a list of the sets of airports where the set at index i is
reachable in at most i flights. Note that iata_src will always appear at
index 0, because it is reachable without flying anywhere.
Precondition: n >= 0
>>> reachable_destinations ('AA1', 0, TEST_ROUTES_DICT_FOUR_CITIES)
[{'AA1'}]
>>> expected = [{'AA1'}, {'AA2', 'AA4'}]
>>> result = reachable_destinations ('AA1', 1, TEST_ROUTES_DICT_FOUR_CITIES)
>>> expected == result
True
>>> expected = [{'AA1'}, {'AA2', 'AA4'}, {'AA3'}]
>>> result = reachable_destinations ('AA1', 2, TEST_ROUTES_DICT_FOUR_CITIES)
>>> expected == result
True
||||||
# Complete your function below
Transcribed Image Text:def count_total_flights(): # Complete this function (including type contract and docstring) #based on the handout description pass def reachable_destinations (iata_src: str, n: int, routes: RouteDict) -> List [Set """Return a list of the sets of airports where the set at index i is reachable in at most i flights. Note that iata_src will always appear at index 0, because it is reachable without flying anywhere. Precondition: n >= 0 >>> reachable_destinations ('AA1', 0, TEST_ROUTES_DICT_FOUR_CITIES) [{'AA1'}] >>> expected = [{'AA1'}, {'AA2', 'AA4'}] >>> result = reachable_destinations ('AA1', 1, TEST_ROUTES_DICT_FOUR_CITIES) >>> expected == result True >>> expected = [{'AA1'}, {'AA2', 'AA4'}, {'AA3'}] >>> result = reachable_destinations ('AA1', 2, TEST_ROUTES_DICT_FOUR_CITIES) >>> expected == result True |||||| # Complete your function below
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Types of trees
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education