-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex12.py
More file actions
14 lines (11 loc) · 724 Bytes
/
Copy pathex12.py
File metadata and controls
14 lines (11 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
# 1 - A partir da lista apresentada, criar um Generator contendo apenas animais
# que comecem com 'C' ou 'A' e que o tamanho de seu nome seja maior que 5.
# Por fim, itere e imprima o Generator.
# listaAnimais = ['Cachorro', 'Avestruz', 'Alce', 'Cavalo', 'Baleia', 'Gato', 'Urso',
# 'Abelha',
# 'Carneiro', 'Cabra', 'Cobra', 'Coelho', 'Mosquito', 'Peixe', 'Macaco', 'Aranha']
listaAnimais = ['Cachorro', 'Avestruz', 'Alce', 'Cavalo', 'Baleia', 'Gato', 'Urso',
'Abelha', 'Carneiro', 'Cabra', 'Cobra', 'Coelho', 'Mosquito', 'Peixe', 'Macaco', 'Aranha']
tuplaAnimais = (animal for animal in listaAnimais if animal[0] == 'C' or animal[0] == 'A' and len(animal) > 5)
for i in tuplaAnimais:
print('=> ', i)