I have this function where it takes in a list of tuples as it's parameter, I'm trying to return the oldest person but in order to do that I need to find the minimum value of the age im just having trouble with this since it's in a list of tuple. I tried to use the min() function but it didn't work out.
def oldest_person(people: list):
new_list = []
age = 1977
for persons in people:
if persons[1] == age:
new_list.append(persons[0])
return new_list
p1 = ("Adam", 1977)
p2 = ("Ellen", 1985)
p3 = ("Mary", 1995)
p4 = ("Ernest", 1997)
people = [p1, p2, p3, p4]
print(oldest_person(people))