Objective
Create a Python program that builds a dictionary and converts it into JSON text with json.dumps.
Instructions
- Read a name, an age (integer) and a line that is
1if the person is a student or0if not. - Create a dictionary with the keys
name,ageandstudent, in that order. The value ofstudentmust be a boolean (TrueorFalse), not a text. - Show the dictionary converted to JSON with
json.dumps(data, ensure_ascii=False), so that accented letters are not escaped.
Ana
30
1
{"name": "Ana", "age": 30, "student": true}
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise