My issue
this is the output:
Traceback (most recent call last):
File “main.py”, line 13, in
lowest_age_person = find_person_with_lowest_age()
File “main.py”, line 6, in find_person_with_lowest_age
for age in p.persons.values():
AttributeError: ‘list’ object has no attribute ‘values’
** Process exited - Return Code: 1 **
Press Enter to exit terminal
Please tell the issue
My code
import persons
b =[]
d = []
def find_person_with_lowest_age():
for age in persons.persons.values():
b.append(age)
c = min(b)
for age,name in persons.persons.items():
if c == age:
d = {"name":name, "age":c}
lowest_age_person = find_person_with_lowest_age()
print("Person with the lowest age:")
print(f"Name: {lowest_age_person['name']}")
print(f"Age: {lowest_age_person['age']}")
Learning course: Advanced Python
Problem Link: Person module - Coding problem in Advanced Python