Question: Python 3 Write a function trip) that takes the following arguments, in this order holding for a one-way trip. 2. places: a dictionary that maps

Python 3

Python 3 Write a function trip) that takes the following arguments, in

Write a function trip) that takes the following arguments, in this order holding for a one-way trip. 2. places: a dictionary that maps destinations (as strings) to distances (as integers). For example, if the key 'LA'is mapped to the value 3000, this means that the destination LA is 3000 miles away from where the person is right now. Your function should scan through the dictionary, then find one farthest destination that the person can travel to based on the max.distance for a one-way trip Note: If max-distance is a number that's zero or less, this means the plane ticket is invalid, and your function should return the value None (NOT the string ' None'). If the plane ticket can't take the person anywhere, return nowhere'. Also, you don't need to worry about two destinations having the same distance. Examples: locations = {, Beijing,: 6836, , Los Angeles, : 2448, 'New York': 50, 'San Francisco': 2569, 'Washington D.C. 204, Pittsburgh' 315, Columbus' 477, 'Tokyo' 6749, Moscow': 4672, 'Paris' 3649, 'Las Vegas' 2230, Kansas City' 1095, Iowa City':913, 'Orlando' 940, 'Island of Hawaii': 4927, 'City B' 1399) Function Call trip (1000, locations) Orlando" trip (0, locations) trip (3848, locations) Paris' trip (10, locations) ,nowhere, Return Value None

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!