palavra1 = {'palavra': 'sim', 'positivo': 0}
palavra2 = {'palavra': 'não', 'positivo': 0}
palavras = [palavra1, palavra2]
resultado1 = filter(lambda termo: termo['palavra'] == 'sim', palavras)
resultado2 = [termo for termo in palavras if termo['palavra'] == 'sim']
resultado3 = (termo for termo in palavras if termo['palavra'] == 'sim')
print('Utilizando filter:', list(resultado1))
print('Utilizando list comprehension:', resultado2)
print('Utilizando generator comprehension:', list(resultado3))
cGFsYXZyYTEgPSB7J3BhbGF2cmEnOiAnc2ltJywgJ3Bvc2l0aXZvJzogMH0KcGFsYXZyYTIgPSB7J3BhbGF2cmEnOiAnbsOjbycsICdwb3NpdGl2byc6IDB9CnBhbGF2cmFzID0gW3BhbGF2cmExLCBwYWxhdnJhMl0KCnJlc3VsdGFkbzEgPSBmaWx0ZXIobGFtYmRhIHRlcm1vOiB0ZXJtb1sncGFsYXZyYSddID09ICdzaW0nLCBwYWxhdnJhcykKcmVzdWx0YWRvMiA9IFt0ZXJtbyBmb3IgdGVybW8gaW4gcGFsYXZyYXMgaWYgdGVybW9bJ3BhbGF2cmEnXSA9PSAnc2ltJ10KcmVzdWx0YWRvMyA9ICh0ZXJtbyBmb3IgdGVybW8gaW4gcGFsYXZyYXMgaWYgdGVybW9bJ3BhbGF2cmEnXSA9PSAnc2ltJykKCnByaW50KCdVdGlsaXphbmRvIGZpbHRlcjonLCBsaXN0KHJlc3VsdGFkbzEpKQpwcmludCgnVXRpbGl6YW5kbyBsaXN0IGNvbXByZWhlbnNpb246JywgcmVzdWx0YWRvMikKcHJpbnQoJ1V0aWxpemFuZG8gZ2VuZXJhdG9yIGNvbXByZWhlbnNpb246JywgbGlzdChyZXN1bHRhZG8zKSk=