Adding function for gathering information about age and number of relations #55
Open
cansuoktem wants to merge 2 commits intoUCL-COMP0233-24-25:mainfrom
Open
Adding function for gathering information about age and number of relations #55cansuoktem wants to merge 2 commits intoUCL-COMP0233-24-25:mainfrom
cansuoktem wants to merge 2 commits intoUCL-COMP0233-24-25:mainfrom
Conversation
gpwhs
reviewed
Oct 17, 2024
gpwhs
left a comment
There was a problem hiding this comment.
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)
| # Your code to go here... | ||
|
|
||
| my_group = | ||
| my_group = {"Jill": |
| 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() |
There was a problem hiding this comment.
this will run every time you import group.py
wrap in a if name == "main" condition :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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