movie_watcher = ['sb_alex', 'sb_raimond', 'jack']
def filter_people(array):
ret = []
for p in array:
if not p.startswith('sb'):
ret.append(p)
return ret
print(filter_people(movie_watcher))
C:\Users\user\AppData\Local\Programs\Python\Python36\python.exe “C:/Users/user/PycharmProjects/hellow python/test.py”
[‘jack’]
Process finished with exit code 0
movie_watcher = ['sb_alex', 'sb_raimond', 'jack']
print(list(filter(lambda n:not n.startswith('sb'), movie_watcher)))
C:\Users\user\AppData\Local\Programs\Python\Python36\python.exe “C:/Users/user/PycharmProjects/hellow python/test.py”
[‘jack’]
Process finished with exit code 0