-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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' #866
base: master
Are you sure you want to change the base?
'Solution' #866
Conversation
app/main.py
Outdated
if "wife" in human.keys(): | ||
if human["wife"] in Person.people: | ||
Person.people[name].wife = Person.people[human["wife"]] | ||
if "husband" in human.keys(): | ||
if human["husband"] in Person.people: | ||
Person.people[name].husband = Person.people[human["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.
Use second loop for this
app/main.py
Outdated
if "wife" in human.keys(): | ||
if human["wife"] in Person.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.
Also, you can use and statement
app/main.py
Outdated
|
||
|
||
def create_person_list(people: list) -> list: | ||
# write your code here | ||
pass | ||
inst_list = [Person(human["name"], human["age"]) for human 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.
inst_list = [Person(human["name"], human["age"]) for human in people] | |
person_instances = [Person(human["name"], human["age"]) for human in people] |
app/main.py
Outdated
def __init__(self, name: str, age: int) -> None: | ||
self.name = name | ||
self.age = age | ||
Person.people[name] = self | ||
|
||
|
||
def create_person_list(people: list) -> list: |
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.
def create_person_list(people: list) -> list: | |
def create_person_list(people: list[dict]) -> list[Person]: |
No description provided.