Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

'Solution' #866

wants to merge 3 commits into from

Conversation

NPovashevych
Copy link

No description provided.

app/main.py Outdated
Comment on lines 14 to 19
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"]]

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
Comment on lines 14 to 15
if "wife" in human.keys():
if human["wife"] in Person.people:

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]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def create_person_list(people: list) -> list:
def create_person_list(people: list[dict]) -> list[Person]:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants