Skip to content

Created friend group model #77

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Some things you may wish to consider in your model:
- Does it allow people who have no job?
- Does it allow people with no connections?
- Does it assume that connections are always reciprocal (e.g. if A is B's friend, does B
automatically consider A a friend too?)
automatically consider A a friend too?)
52 changes: 51 additions & 1 deletion group.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,54 @@

# Your code to go here...

my_group =
my_group = {
"Jill": {
"age": 26,
"job": ["biologist"],
"relationships": {
"friend": "Zalika",
"partner": "John"
}
},

"Zalika": {
"age": 28,
"job": ["artist"],
"relationships": {
"friend": "Jill",
"landlord": "Nash"
}
},

"John": {
"age": 27,
"job": ["writer"],
"relationships": {
"partner": "Jill",
"cousin": "Nash"
}
},

"Nash": {
"age": 34,
"job": ["chef"],
"relationships": {
"cousin": "John",
"tenant": "Zalika"
}
},

"Nanashi": {
"age": 20,
"job": [],
"relationships": {}
}
}

# checking if the dictionary correctly reflects relations
for names in my_group.keys():
if my_group[names]["relationships"]:
for name2 in my_group[names]["relationships"].values():
print (f"{names} knows {name2}")
else:
print (f"{names} doesn't know anyone in my group.")