My issue
import persons
def find_person_with_lowest_age():
x=persons.[0]
for i in range(1,len(persons)):
if x[‘age’]>presons[i][‘age’]:
x=persons[i]
return x
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’]}”)
I want to know what is the error in the above code.
My code
import persons
def find_person_with_lowest_age():
x=persons.[0]
for i in range(1,len(persons)):
if x['age']>presons[i]['age']:
x=persons[i]
return x
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