-
Notifications
You must be signed in to change notification settings - Fork 69
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
Using Comprehension expressions #49
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good
add error handling
@@ -1,5 +1,23 @@ | |||
"""An example of how to represent a group of acquaintances in Python.""" | |||
|
|||
# Your code to go here... | |||
#For the relationship of each person, it is like: the front person is the “relationship” of the behind person. | |||
my_group = { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I did not. This kind of format is set manually
group.py
Outdated
max_con_age = np.max([my_group[person]['age'] for person in my_group if len(my_group[person]['relationship']) >= 1 ]) | ||
print('the maximum age of people in the group that have at least one relation is',max_con_age) | ||
|
||
max_fricon_age = np.max([my_group[person]['age'] for person in my_group if 'friend' in my_group[person]['relationship'] and len(my_group[person]['relationship']['friend']) >= 1 ]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird variable name imo
Answers UCL-COMP0233-24-25/RSE-Classwork#7