-
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
Coluton #842
base: master
Are you sure you want to change the base?
Coluton #842
Conversation
важка тема для розуміння, в години котрі вказані в гуглдок файлі точно не вклався |
app/main.py
Outdated
|
||
def create_person_list(people: list[dict]) -> list: | ||
|
||
people_list = [Person(i["name"], i["age"]) for i in people] |
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.
i
bad variable name
app/main.py
Outdated
people_list = [Person(i["name"], i["age"]) for i in people] | ||
for i in people: | ||
if i.get("wife"): | ||
Person.people[i["name"]].wife = Person.people[i["wife"]] |
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.
use get()
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.
I don’t understand, one more "get"?
app/main.py
Outdated
for preson in people: | ||
if preson.get("wife"): | ||
Person.people[preson["name"]].wife \ | ||
= Person.people[preson["wife"]] | ||
if preson.get("husband"): | ||
Person.people[preson["name"]].husband \ | ||
= Person.people[preson["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.
for preson in people: | |
if preson.get("wife"): | |
Person.people[preson["name"]].wife \ | |
= Person.people[preson["wife"]] | |
if preson.get("husband"): | |
Person.people[preson["name"]].husband \ | |
= Person.people[preson["husband"]] | |
for preson in people: | |
person_instance = Person.people[preson.get("name")] | |
if preson.get("wife"): | |
person_instance.wife = Person.people[preson.get("wife")] | |
if preson.get("husband"): | |
person_instance.husband = Person.people[preson.get("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.
Well done!
No description provided.