python forとifを使った簡単なフィルター処理
youngPeople = []
for (person, age) in input:
if age < 30:
youngPeople.append(person)
else:
print(person + 'is too old!')
print('There are ' + str(len(youngPeople)) + ' young people')
Output
>>
Joeis too old!
Ruthis too old!
There are3 young people