-
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
SOL #767
base: master
Are you sure you want to change the base?
SOL #767
Conversation
app/main.py
Outdated
|
||
for person in people: | ||
if person[list(person.keys())[2]] is not None: | ||
if list(person.keys())[2] == "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.
if list(person.keys())[2] == "wife": | |
if person.get("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.
try do it with get()
app/main.py
Outdated
Person(name=person["name"], age=person["age"]) | ||
|
||
for person in people: | ||
if person[list(person.keys())[2]] is not None: |
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.
it is bad code
app/main.py
Outdated
for person in people: | ||
if person.get("wife") is not None: | ||
Person.people[person["name"]].wife =\ | ||
Person.people[person[list(person.keys())[2]]] |
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.
don't use list(person.keys())[2]] , use key "wife"
No description provided.