saving changes

This commit is contained in:
2022-01-12 13:32:51 -06:00
parent a572b69670
commit 06b4ecc96c
5 changed files with 52 additions and 20 deletions
+1 -1
View File
@@ -1 +1 @@
from .animal_requests import get_all_animals
from .animal_requests import get_all_animals, get_single_animal
+16 -1
View File
@@ -24,4 +24,19 @@ ANIMALS = [
def get_all_animals():
return ANIMALS
return ANIMALS
# Function with a single parameter
def get_single_animal(id):
# Variable to hold the found animal, if it exists
requested_animal = None
# Iterate the ANIMALS list above. Very similar to the
# for..of loops you used in JavaScript.
for animal in ANIMALS:
# Dictionaries in Python use [] notation to find a key
# instead of the dot notation that JavaScript used.
if animal["id"] == id:
requested_animal = animal
return requested_animal
View File
View File