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

Using Comprehension expressions #49

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

Conversation

Songzx07
Copy link

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.

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 = {
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?

Copy link
Author

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 ])
Copy link

Choose a reason for hiding this comment

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

weird variable name imo

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.

2 participants