Question: The program below needs some additional steps completed. The sample data is a nested dictionary. Your task is to fill in the indices necessary to
The program below needs some additional steps completed. The sample data is a nested dictionary. Your task is to fill in the indices necessary to extract the latitude ('lat'), longitude ('lng'), and formatted address. Note that extra sample data will be use to test whether your function operates correctly on new data objects so make sure your program correctly references the function parameter.
CodeText
def extract_location(data):
# extract latitude, longitude and formatted address of the first matching location
# Fill in the blanks to make the code work
#### YOUR CODE -- fill in the blanks ###
latitude = data['results'][-][----][----]['lat']
longitude = data[----][0][----][----][----]
formatted_address = data[----][--][----]
# tests:
print("latitude:", latitude)
print("longitude:", longitude)
print("address:", formatted_address)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
