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

Adding function for gathering information about age and number of relations #55

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cansuoktem
Copy link

Defined a function titled age_relation_info which prints out:
-the maximum age of people in the group
-the average number of relations among members of the group
-the maximum age of people in the group that have at least one relation
-the maximum age of people in the group that have at least one friend

Answers UCL-COMP0233-24-25/RSE-Classwork#7

Copy link

@gpwhs gpwhs left a comment

Choose a reason for hiding this comment

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

generally okay but you don't need to loop through group multiple times, you can get all of the info you need from one loop

also add error handling (e.g. group might not exist)

@@ -2,4 +2,32 @@

# Your code to go here...

my_group =
my_group = {"Jill":
Copy link

Choose a reason for hiding this comment

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

did you run the formatter here? (ruff)

f"Max Age: {max(age_vec)}; Average Relations: {sum(relation_vec)/len(group)}; Max Age with >=1 Relation: {max(age_relat_vec)}; Max Age with >=1 Friend: {max(age_friend_vec)}"
)

age_relation_info()
Copy link

Choose a reason for hiding this comment

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

this will run every time you import group.py

wrap in a if name == "main" condition :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants