Skip to content

Commit

Permalink
In the create_person_list function, the list creation format has been…
Browse files Browse the repository at this point in the history
… transformed into list comprehension.
  • Loading branch information
Moonralex committed Oct 25, 2023
1 parent da4b8dd commit ed977cc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ def __init__(self, name: str, age: int) -> None:


def create_person_list(people: list) -> list:
result_list = []
for person_dict in people:
name = person_dict["name"]
Person(name, person_dict["age"])
result_list.append(Person.people[name])
result_list = [
Person(person_dict["name"], person_dict["age"])
for person_dict in people
]
for person_dict in people:
name = person_dict["name"]
if "wife" in person_dict and person_dict["wife"] is not None:
Expand Down

0 comments on commit ed977cc

Please sign in to comment.