1# Filter function
2def with_s(student):
3 return student.startswith('s')
4
5students = ['sarah', 'mary', 'sergio', 'lucy'] # define a list
6s_filter = filter(with_s, students) # filter() returns true or false
7print(next(s_filter)) # filter() returns a generator
8print(list(s_filter)) # give all elements of the generator