Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions