Question: Python 3 This is producing the wrong answers when i try other random exampls def trip(max_distance, places): if max_distance return None else : max =0

Python 3
This is producing the wrong answers when i try other random exampls
def trip(max_distance, places): if max_distance return None else: max =0 place="" for k,v in locations.items(): if v and v > max: max = v place = k if max == 0: return 'no where' else: return place
Part I: Farthest Destination (20 points) Write a function trip that takes the following arguments, in this order: 1. max.distance: an integer that represents how far a person can travel based on the plane ticket he/she is 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. CSE 101 - Fall 2017 Lab #7 Page 1 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, returrn nowhere'. Also, you don't need to worry about two destinations having the same distance
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
