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

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

Conversation

Roman-Sokolov-V
Copy link

No description provided.

app/main.py Outdated
Comment on lines 11 to 14
"""

:param incoming_list:
:return:
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to use a docstring as it is a simple function

app/main.py Outdated
Comment on lines 16 to 21
persons_list = []
for part_of_list in incoming_list:
name = part_of_list["name"]
age = part_of_list["age"]
person = Person(name, age)
persons_list.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 to create a list ofPerson

app/main.py Outdated
age = part_of_list["age"]
person = Person(name, age)
persons_list.append(person)
for i, part_of_list in enumerate(incoming_list):
Copy link
Contributor

Choose a reason for hiding this comment

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

By using a more descriptive name like indexinstead of i you make your code more readable and help others understand the purpose of the loop variable

app/main.py Outdated
Comment on lines 23 to 28
if part_of_list.get("wife"):
persons_list[i].wife = \
Person.people[part_of_list.get("wife")]
if part_of_list.get("husband"):
persons_list[i].husband = \
Person.people[part_of_list.get("husband")]
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 split lines without using backslashes by enclosing the expression in parentheses.

app/main.py Outdated
# write your code here
pass

def create_person_list(incoming_list: 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(incoming_list: list) -> list:
def create_person_list(incoming_list: list) -> list:

Let's rename variables because naming is so bad now
incoming_list -> people_data
persons_list -> people
part_of_list -> person

Choose a reason for hiding this comment

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

Also,
people - багато людей
person - одна людина

Copy link

@ArsenPidhoretskyi ArsenPidhoretskyi left a comment

Choose a reason for hiding this comment

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

.

Copy link

@ArsenPidhoretskyi ArsenPidhoretskyi left a comment

Choose a reason for hiding this comment

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

Small fix)

app/main.py Outdated
people = [Person(person["name"], person["age"])
for person in people_data]

for index, part_of_list in enumerate(people_data):

Choose a reason for hiding this comment

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

part_of_list -> person

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.

Good job!

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