EX 1 - SUJET 25
unknown
python
4 years ago
479 B
5
Indexable
animaux = [ {'nom':'Medor', 'espece':'chien', 'age':5, 'enclos':2},
{'nom':'Titine', 'espece':'chat', 'age':2, 'enclos':5},
{'nom':'Tom', 'espece':'chat', 'age':7, 'enclos':4},
{'nom':'Belle', 'espece':'chien', 'age':6, 'enclos':3},
{'nom':'Mirza', 'espece':'chat', 'age':6, 'enclos':5}]
def selection_enclos(table_animaux,num_enclos):
table = []
for x in table_animaux:
if x['enclos'] == num_enclos:
table.append(x)
return table
Editor is loading...