-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Solution #854
base: master
Are you sure you want to change the base?
Solution #854
Conversation
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.
Tests not passed!
app/main.py
Outdated
person_list = [] | ||
for person in people: | ||
person1 = list(person.values()) | ||
name = person1[0] | ||
age = person1[1] | ||
|
||
person_list.append(Person(name, age)) |
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.
try to use list comprehension
app/main.py
Outdated
count = 0 | ||
for person1 in people: | ||
if "wife" in person1: | ||
for person2 in person_list: | ||
if person2.name == person1["wife"]: | ||
person_list[count].wife = person2 | ||
|
||
else: | ||
for person2 in person_list: | ||
if person2.name == person["husband"]: | ||
person_list[count].husband = person2 | ||
count += 1 |
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.
count = 0 | |
for person1 in people: | |
if "wife" in person1: | |
for person2 in person_list: | |
if person2.name == person1["wife"]: | |
person_list[count].wife = person2 | |
else: | |
for person2 in person_list: | |
if person2.name == person["husband"]: | |
person_list[count].husband = person2 | |
count += 1 | |
for pl in people: | |
person = Person.people[pl["name"]] | |
if pl.get("wife"): | |
person.wife = Person.people[pl["wife"]] | |
if pl.get("husband"): | |
person.husband = Person.people[pl["husband"]] |
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.
Good Job 👍
No description provided.