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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started