Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

added statistics readout #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,49 @@
# Your code to go here...

my_group =
"""An example of how to represent a group of acquaintances in Python."""

# Your code to go here...

my_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"
}
}
}

print("max age:" + str(max([value['age'] for value in my_group.values()])))

a = [len(value['relations']) for value in my_group.values()]

print("Average no of relations: " + str(sum(a)/len(a)))

b = [value['age'] for value in my_group.values() if len(value['relations']) >= 1]

print("Max age of people with >= 1 relation: " + str(max(b)))
Comment on lines +45 to +51
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good start. more meaningful variable names here would probably help!