Skip to content

Will - Answers UCL-MPHY0021-21-22/RSE-Classwork#12#17

Open
will43w wants to merge 3 commits intoUCL-MPHY0021-21-22:mainfrom
will43w:will
Open

Will - Answers UCL-MPHY0021-21-22/RSE-Classwork#12#17
will43w wants to merge 3 commits intoUCL-MPHY0021-21-22:mainfrom
will43w:will

Conversation

@will43w
Copy link

@will43w will43w commented Oct 21, 2021

Copy link
Collaborator

@stefpiatek stefpiatek left a comment

Choose a reason for hiding this comment

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

Good fun, a couple of general suggestions but looks like it should work!

Comment on lines +51 to +59
YLTWH = Group()

Jill = Person("Jill", 26, ["Biologist"], {"Zalika": "Friend", "John": "Partner"})
Zalika = Person("Zalika", 28, ["Artist"], {"Jill": "Friend"})
John = Person("John", 27, ["Writer"], {"Jill": "Partner"})
Nash = Person("Nash", 34, ["Chef", "Landlord"], {"John": "Cousin", "Zalika": "Landlord"})

for person in [Jill, Zalika, John, Nash]:
YLTWH.add_person(person)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, you could have a create person method to the Group class, so that you only interact with the Group and don't need to know about the underlying person class when using the group


# YLTWH.mutualize_relationships()

print("Maximum age of people in the group: {0}".format(YLTWH.hwkq1_max_age()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you're using python 3.6+ you can use f strings here

Suggested change
print("Maximum age of people in the group: {0}".format(YLTWH.hwkq1_max_age()))
print(f"Maximum age of people in the group: {YLTWH.hwkq1_max_age()}")

# except:
# pass

def hwkq1_max_age(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

after a while I worked out it home work question 1 at a prefix. it's a dummy example so I get why but overall I'd go for a longer name so it's more readable like homework_1_max_age

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