List that contains the people who’s age is equal or younger

homework
python

#1

Hi, I need your assistance again. if I have a list of names followed by their age. e.g.[[“John”,“24”],[“Harvey”,“22”],[“Nathan”,“19”],[“Jeff”,“17”]]. The question is, how would I code so that if I enter “22”, the computer automatically creates a list that contains the people who’s age is equal or younger to the value that I have entered-“22”?


Iterating through a list:finding common values
#2
members = [['John','24'], ['Harvey','22'], ['Nathan','19'], ['Jeff','17']]

age = input("Enter the age to look up: ")

matches = []
for item in members:
    if item[1] <= age:
        matches.append(item)

for item in matches:
    print (item)
 Python 3.6.1 (default, Dec 2015, 13:05:11)
 [GCC 4.8.2] on linux
 >
 Enter the age to look up:  22
 ['Harvey', '22']
 ['Nathan', '19']
 ['Jeff', '17']
 >

#3

Thanks, i appreciate your help.