My question is about find_age() method in this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

My question is about find_age() method in this code

personList is a list of objects, after adding 3 people and their information to the list i want the user to look for an age inside the list and see if he she gets a match (positions inside the list). For that i wrote the find_age() method but its not working. Plz check the code: https://code.sololearn.com/cHSG42NUYWxS/?ref=app

1st Mar 2022, 6:39 PM
Lenoname
9 Answers
+ 8
Lenoname , you have defined functions to get the age, but they never get called. see my suggestion at the end of the code: https://code.sololearn.com/c0TGo7cbkJ7a/?ref=app
1st Mar 2022, 9:21 PM
Lothar
Lothar - avatar
+ 5
Lenoname , no problem, you can use enumerate(...) in the comprehension. happy coding!
2nd Mar 2022, 10:19 AM
Lothar
Lothar - avatar
0
what about it doesn't work? And can you supply some base inputs on your code so we don't have to input every time?
1st Mar 2022, 8:32 PM
Slick
Slick - avatar
0
Slick ok check again i, ignore the comment code, i get ”<built in method…..”
1st Mar 2022, 8:46 PM
Lenoname
0
with what input? please add it
1st Mar 2022, 8:47 PM
Slick
Slick - avatar
0
Slick also if u can rewrite the code in #comments that would awesome.
1st Mar 2022, 8:48 PM
Lenoname
0
great add input
1st Mar 2022, 8:49 PM
Slick
Slick - avatar
0
Slick doesnt matter , if its in the list it should be printed out , if its not its probably going to show empty brackets
1st Mar 2022, 8:52 PM
Lenoname
0
Lothar i want their position in the list of objects, ex: [0] or [1]
1st Mar 2022, 9:27 PM
Lenoname