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 #828

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

Solution #828

wants to merge 3 commits into from

Conversation

Marinel444
Copy link

No description provided.

app/main.py Outdated
Comment on lines 12 to 17
result = []

for item in people:
person = Person(name=item["name"], age=item["age"])
married_dict[item["name"]] = person
result.append(person)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using a list comprehension for a more concise approach

app/main.py Outdated


def create_person_list(people: list) -> list:
# write your code here
pass
married_dict = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need this dict?

Copy link
Author

Choose a reason for hiding this comment

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

to make a connection between married people

app/main.py Outdated
married_dict[item["name"]] = person
result.append(person)

for item in people:
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using person instead of item for clarity

app/main.py Outdated
result.append(person)

for item in people:
person_obj = married_dict[item["name"]]
Copy link
Contributor

Choose a reason for hiding this comment

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

You can create a variable for 'person' and then use it, instead of adding it to the dictionary

app/main.py Outdated
Comment on lines 14 to 15
Person.people.get(person["name"]).wife = \
Person.people.get(person["wife"])
Copy link
Contributor

Choose a reason for hiding this comment

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

you can avoid using a backslash by breaking the code into multiple lines using parentheses to indicate a continuation

Copy link
Contributor

@viktoria-rybenchuk viktoria-rybenchuk left a comment

Choose a reason for hiding this comment

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

Well done!

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.

2 participants