PRACTICE

JSON Data

Lesson notes

Your task

Parse the JSON string {"score": 42} and print the score.

Expected output
42
Loading…

OUTPUT

Worked solution
import json
text = '{"score": 42}'
print(json.loads(text)["score"])

Checks compare printed output, not your approach. Several solutions can be valid.

← Back to courses