The nurse understands that administering a hypotonic solutio…
Questions
The nurse understаnds thаt аdministering a hypоtоnic sоlution to a patient will shift water from the _____ to the _____ space.
This is а twо-pаrt prоgrаmming prоblem. Please submit one or both parts in a single .py file. The recent government shutdown is the longest in US history. Air traffic controllers are not being paid, and as a result many are not coming to work. Beginning last Friday, airlines have been ordered to cut the number of routes they fly by 20% for large airports (like Minneapolis, Chicago, and Atlanta) and 10% for smaller airports (such as Fort Myers, FL, or Bozeman, MT). The file routes_final.csv (right click, open in new tab or window) contains information about daily airline routes. The columns contain: Air carrier code (ex. DL = Delta) Air carrier name ("American Airlines"). Note that not all entries have an expanded air carrier name. Origin code (MSP = Minneapolis, ORD = Chicago O'Hare, ATL = Atlanta, etc) Destination code Number of stops Distance (in nautical miles, or nm) The file is sorted by distance, listing the shortest routes first. Part 1: Counting Flights by Origin and Carrier (35 pts) Write a function named flights_by_origin that accepts three arguments: a filename, a carrier code, and an origin. Return a tuple containing a count of the number of flights operated by that airline from that origin, and the destination of the shortest flight operated from that origin. The shortest flight, of course, is the most likely flight to be cut during the government shutdown. Delta operates 127 daily routes out of Minneapolis (MSP). Nearby Rochester (RST) is the shortest route Delta operates out of MSP: In [1]: flights_from_origin('routes_final.csv', 'DL', 'MSP') Out[1]: (127, 'RST') American Airlines operates 124 daily routes from Chicago O'Hare (ORD). Milwaukee, WI (MKE), is the shortest route American operates out of ORD: In [2]: flights_from_origin('routes_final.csv', 'AA', 'ORD') Out[2]: (124, 'MKE') Finally, United Airlines operates 138 daily routes from Denver, CO. Colorado Springs, CO (COS), is the shortest route United operates from DEN: In [3]: flights_from_origin('routes_final.csv', 'UA', 'DEN') Out[3]: (138, 'COS') If the carrier or origin cannot be found, return a tuple containing 0 and the empty string: In [4]: flights_from_origin('routes_final.csv', 'DL', 'FMY') Out[4]: (0, '') Part 2: Shortest n% of routes (10 pts) Many airlines cut their schedule by looking at the shortest routes first. Write a function named destinations_to_cut that accepts four arguments: a filename, carrier code, origin code, and a whole-number percentage n. Return a list of destinations in the shortest n% of routes for that carrier and origin. Delta operates 127 daily routes from MSP. The government wants Delta to cut 20% of flights from major airports like MSP. So, Delta will begin their cuts by looking at the shortest 26 routes (20% of 127, rounded up): In [1]: destinations_to_cut('routes_final.csv', 'DL', 'MSP', 20) Out[1]: ['RST', 'BRD', 'LSE', ..., 'ORD', 'PIA', 'MDW'] United operates 138 daily routes from DEN, so they need to look at their shortest 28 routes (20% of 138): In [2]: destinations_to_cut('routes_final.csv', 'UA', 'DEN', 20) Out[2]: ['COS', 'CYS', 'PUB', ..., 'ICT', 'LNK', 'BIL'] Delta only operates 7 daily routes from Fort Myers, FL (RSW). In addition, RSW is a smaller airport requiring only a 10% reduction in flights. Therefore, Delta only needs to look at their single (10% of 7, rounded up) shortest route from RSW: In [3]: destinations_to_cut('routes_final.csv', 'DL', 'RSW', 10) Out[3]: ['ATL'] If the carrier or origin cannot be found, or the required percentage is 0 (or less), return the empty string: In [4]: destinations_to_cut('routes_final.csv', 'DL', 'ANE', 10) Out[4]: []