Question: Question 1 Part 1 I have this answer below, I need help with part 2) Import the Python module 'json' with an appropriate import statement

Question 1

Part 1 I have this answer below, I need help with part 2)

Import the Python module 'json' with an appropriate import statement

Load the contents of the file 'astros.json' into a string object called text_astros

Use the loads function from the module json to extract the contents of the string

text_astros into a dict called data_astros

(answer: import json

with open('astros.json') as f:

text_astros = f.read()

data_astros = json.loads(text_astros))

Part 2

Extract the numerical value associated with the key "number" from the dict data_astros;

bind that value to the identifier num_people_in_space.

Create sorted list called people that contains the names of all the people

currently in space. Do not separate the names into first & last names; simply

sort the strings lexicographically as they are.

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 Programming Questions!