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
Step by stepSolved in 3 steps
- Define the function print_trophic_class_summary(tli3_values) that accepts a list of trophic level index values and prints a summary outlining the number of lakes in each trophic classification, in order from highest trophic classification to lowest. See the examples for the required format. Notes: Your function must print the summary, not return it. In each state line, the initial number should be formatted with width 3. (Hint: :3 will be helpful) All possible states must be included in the output, even states with zero lakes. The following list will be helpful: ['Hypertrophic', 'Supertrophic', 'Eutrophic', 'Mesotrophic', 'Oligotrophic', 'Microtrophic', 'Ultra-microtrophic'] You must include and use one of your number_in_trophic_class functions (take your pick!), plus your trophic_class function. Basically, you can start with your answer to Question 5 or 6 and add your print_trophic_class_summary function definition after your previous definitions. For example: Test Result…arrow_forwardModify following delete() function so that it takes only two arguments, first and x without trail. void delete(listPointer *first, listPointer trail, listPointer x) { if (trail) trail -> link = x -> link; else *first = (*first) -> link; free(x); }arrow_forwarddef clean_span_data(raw_spans: str) -> List[float]:"""Return a list of span lengths from raw_spans, in the same order thatthey appear in raw_spans. Precondition:- raw_spans is in the appropriate format (see handout for details) >>> clean_span_data('Total=64 (1)=12;(2)=19;(3)=21;(4)=12;')[12.0, 19.0, 21.0, 12.0]"""arrow_forward
- def create_category(info): li = info.split() if len(li) == 2: if is_numeric(li[1]) == True: li[2] = float(l[2]) else: return -1 else: return -2 """ Given a string `info`, which is supposed to contain the category name and its percentage, return a two-element list, which contains this information stored as a string and a float respectively. Calls is_numeric() to verify that the percentage is a numeric value (int or float). Stores the percentage as a float (not as a string). E.g., if the input is "Quiz 25", the function returns a list: ["Quiz", 25.0] If splitting the `info` string does not result in a two-element list, then return -2. If the last input value (the percentage) in `info` is not numeric (int or float), does not update the list and returns -1 instead. """ debugarrow_forwardTwo friends at a restaurant each order a fruit drink. The available flavors are watermelon (W), kiwi (K), or peach (P). Write an organized list using the format (Friend 1, Friend 2) to represent the sample space of the friends' fruit drinks.arrow_forward2. Each student at Middlesex County College takes a different number of courses, so the registrar has decided to use linear linked lists to store each student's class schedule and an array to represent the entire student body. A portion of this data structure is shown below: link Sec cr CSC16213 →HISHO 24 $||1|| 1/1234 2/2 357 CSC236/4 37 These data show that the first student (ID: 1111) is taking section 1 of CSC162 for 3 credits and section 2 of HIS101 for 4 credits; the second student is not enrolled; the third student is enrolled in CSC236 section 4 for 3 credits. s Write a class for this data structure. Provide methods for creating the original array, inserting a student's initial class schedule, adding a course, and dropping a course. Include a menu-driven program that uses the class.arrow_forward
- In Ocaml Map functions left Write a function map_fun_left : (’a -> ’a) list -> ’a list -> ’a list = that is given a list of functions and a list of elements. For each element apply all functions from left to it and keep the result. Return the results as a list. examplesmap_fun_left [((+) 1) ;( * ) 2; fun x - >x -10] [1;2;3;4];;- : int list = [ -6; -4; -2; 0]map_fun_left [( fun x - > int_of_char x | > (+) 32 | >char_of_int ) ;( fun x - > char_of_int (( int_of_char x )+1) ) ] [ ’A ’; ’B ’; ’C ’; ’D ’];;- : char list = [ ’b ’; ’c ’; ’d ’; ’e ’]arrow_forwarddef get_nearest_station(my_latitude: float, my_longitude: float, stations: List['Station']) -> int: "''Return the id of the station from stations that is nearest to the location given by my_latidute and my_longitude. In the case of a tie, return the ID of the last station in stations with that distance. Preconditions: len(stations) > 1 » get_nearest_station(43.671134, -79.325164, SAMPLE_STATIONS) 7571 » get_nearest_station(43.674312, -79.299221, SAMPLE_STATIONS) 7486arrow_forwardWhat do the urlretrieve and urlopen functions do?arrow_forward
- def upgrade_stations(threshold: int, num_bikes: int, stations: List["Station"]) -> int: """Modify each station in stations that has a capacity that is less than threshold by adding num_bikes to the capacity and bikes available counts. Modify each station at most once. Return the total number of bikes that were added to the bike share network. Precondition: num_bikes >= 0arrow_forwardComplete the doctring.def average_daily_temp(high_temps: List[int], low_temps: List[int]) -> List[float]: """high_temps and low_temps are daily high and low temperatures for a series of days. Return a new list of temperatures where each item is the daily average. Precondition: len(high_temps) == len(low_temps) >>> average_daily_temp([26, 27, 27, 28, 27, 26], [20, 20, 20, 20, 21, 21]) [23.0, 23.5, 23.5, 24.0, 24.0, 23.5] """arrow_forwardWrite the lines of code to insert the key (book's ISBN) and value ("book") pair into "my_hash_table".arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education