Skip to content

Completed Friend Group Task #12

Open
mrmoodyd wants to merge 1 commit intoUCL-MPHY0021-21-22:mainfrom
mrmoodyd:David
Open

Completed Friend Group Task #12
mrmoodyd wants to merge 1 commit intoUCL-MPHY0021-21-22:mainfrom
mrmoodyd:David

Conversation

@mrmoodyd
Copy link

@zengxueyuan (Not sure of other members ID's)
Answers UCL-MPHY0021-21-22/RSE-Classwork#7

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.

cool!

@@ -1,5 +1,21 @@
"""An example of how to represent a group of acquaintances in Python."""
class PersonData:
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's a really nice way to model out a person!

Choose a reason for hiding this comment

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

Within the print() at the end of the attempt, they are accessing all connections under 'John', but maybe it would also be useful to have a way to access the global connections/network.

zalika = PersonData('Zalika', 28, 'Artist', {'Friend':['Jill']})
john = PersonData('John',27,'Writer',{'Partner':['Jill']})
nash = PersonData('Nash',34,'Chef',{'Cousin':['John'],'Landlord':['Zalika']})

Choose a reason for hiding this comment

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

It looks more clean and organised, tidy.

Choose a reason for hiding this comment

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

They put all the connections in list.

self.name = name
self.age = age
self.occupation = occupation
self.connections = connections

Choose a reason for hiding this comment

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

Prevents repetition

john = PersonData('John',27,'Writer',{'Partner':['Jill']})
nash = PersonData('Nash',34,'Chef',{'Cousin':['John'],'Landlord':['Zalika']})

# Your code to go here...
Copy link

Choose a reason for hiding this comment

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

I really like the approach of defining each person as a PersonData object and then creating a dictionary of those objects. I feel like you might be overusing the person's name as it is a variable in the class, the name of the object and the key in the dictionary. It might be worth changing one of these into a unique identifier in case there were two or more people with the same name in the data.

Copy link

@chrisnasseh chrisnasseh left a comment

Choose a reason for hiding this comment

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

Very good and straightforward

self.name = name
self.age = age
self.occupation = occupation
self.connections = connections

Choose a reason for hiding this comment

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

Our group discussed the interesting use of class

friendGroup = {
'Jill': jill,
'Zalika': zalika,
'John': john,

Choose a reason for hiding this comment

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

This use of dictionary seemed appropriate and helped us better understand dictionaries

Copy link

@erg43 erg43 left a comment

Choose a reason for hiding this comment

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

This looks clever. It seems efficient to access

erg43 added a commit to erg43/friend-group that referenced this pull request Oct 22, 2021
scerbo-robert added a commit to will43w/friend-group that referenced this pull request Oct 27, 2021
Trying to practice by attempting homework UCL-MPHY0021-21-22#12 group.py
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.

8 participants