Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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!