Working with APIs. First course. Question8

In question 8 first course the question is following:

  • Get the duration value of the ISS’s first pass over San Francisco and assign the value to first_pass_duration

But how should I know, that the answer have to be the following

  • first_pass_duration = json_data[“response”][0][“duration”]

Did I miss the explanation in the previous steps? Can someone explain?

It would be helpful if you add the Mission Step URL to your post so that there’s enough context to help out with your problem.

But based on what you have mentioned, in the exercise code it’s pointed out -

# Get the response data as a Python object.  Verify that it's a dictionary.
json_data = response.json()

So, you can see from the above code and the comment that json_data would be a dictionary. And the above code also prints out the dictionary for you to check out its structure and content.

Based on that, and all that you have learned so far about dictionaries in Python and indexing, you should be able to extract the duration value. Break down each step and compare it to the dictionary’s structure if you are unclear about this.