This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Hw3 json r/w #48
Open
Chiiizzzy
wants to merge
5
commits into
UCL-RITS:main
Choose a base branch
from
Chiiizzzy:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Hw3 json r/w #48
Conversation
This file contains 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
Answers UCL-RITS/rse-classwork-2020#11 |
stefpiatek
reviewed
Oct 29, 2020
Comment on lines
+39
to
+42
ages = [my_group[key]['age'] for key in my_group.keys()] | ||
relations = [my_group[key]['relations'] for key in my_group.keys()] | ||
ages_with_r = [my_group[key]['age'] for key in my_group.keys() if my_group[key]['relations']] | ||
ages_with_f = [my_group[key]['age'] for key in my_group.keys() if 'friend' in my_group[key]['relations'].values() ] |
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.
👍
Comment on lines
+44
to
+47
print('the maximum age of people in the group: %d' %max(ages)); | ||
print('the average (mean) number of relations among members of the group: %.2f' %(sum(ages)/len(ages))) | ||
print('the maximum age of people in the group that have at least one relation: %d' %max(ages_with_r)) | ||
print('the maximum age of people in the group that have at least one friend: %d' %max(ages_with_f)) |
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.
maybe using a f string or a string.format() here would be more clear and modern python
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Answers UCL-RITS/rse-classwork-2020#10