diff --git a/group.py b/group.py index e2ec347..46a0740 100644 --- a/group.py +++ b/group.py @@ -1,5 +1,44 @@ -"""An example of how to represent a group of acquaintances in Python.""" +import json -# Your code to go here... +group = { + "Jill": { + "age": 26, + "job": "biologist", + "relations": { + "Zalika": "friend", + "John": "partner" + } + }, + "Zalika": { + "age": 28, + "job": "artist", + "relations": { + "Jill": "friend" + } + }, + "John": { + "age": 27, + "job": "writer", + "relations": { + "Jill": "partner" + } + }, + "Nash": { + "age": 34, + "job": "chef", + "relations": { + "John": "cousin", + "Zalika": "landlord" + } + } +} -my_group = +# write file +with open('group_friends.json', 'w') as json_file: + json.dump(group, json_file, indent=4) + + +with open('group_friends.json', 'r') as json_file: + group_friends = json_file.read() + +print(group_friends) diff --git a/group_friends.json b/group_friends.json new file mode 100644 index 0000000..43462ec --- /dev/null +++ b/group_friends.json @@ -0,0 +1,32 @@ +{ + "Jill": { + "age": 26, + "job": "biologist", + "relations": { + "Zalika": "friend", + "John": "partner" + } + }, + "Zalika": { + "age": 28, + "job": "artist", + "relations": { + "Jill": "friend" + } + }, + "John": { + "age": 27, + "job": "writer", + "relations": { + "Jill": "partner" + } + }, + "Nash": { + "age": 34, + "job": "chef", + "relations": { + "John": "cousin", + "Zalika": "landlord" + } + } +} \ No newline at end of file