Files
lab_weather/people.py
caglazir 581f77b463 I worked on the friends functions and the weather.
Checkpoint 1: I kind of hated how the test_friend_functions worked.
It was overstimulating and I had to move my friend_functions code into
the people code to test them out. I did end up getting correct results
for the functions that I created but I couldm't figure out what was
happening to these results when I ran them with test_friend_functions
instead. I took too much time getting frustrated on this part so I
decided to move on after thinking that I got the general gist of it.
I also talked to Molly and we both thought this part was frustrating and
moved on after a while.

Checkpoint 2: This part of the lab was less frustrating than the one
before. I guess understanding what the weather API did helped a lot as well
as the practice from frined functions to call things appropriately.
My general understanding of what all these systems have in common is that
they all rely on inputs one way or the other. For more complex systems such
as the weather that draws from online data, we also have to be careful with
how to integrate and recall outputs to continue and then categorize them
as we need.
2025-10-25 17:39:49 -04:00

97 lines
2.3 KiB
Python

# people.py
# ------------
# By MWC Contributors
#
# Defines two data structures containing people data, meant to be used
# with the functions in `friend_functions.py`.
# You don't need to do anything with thie file.
family = [
{
"name": "Tad Winters",
"email": "ligula.aenean@hotmail.edu",
"favorite_colors": ["aqua", "red"],
},
{
"name": "Raphael Chambers",
"email": "ac.eleifend.vitae@protonmail.com",
"favorite_colors": ["blue"],
},
{
"name": "Perry Calderon",
"email": "mus.donec@outlook.org",
"favorite_colors": ["black", "white", "grey"],
},
{
"name": "Walker Hurley",
"email": "auctor.odio@icloud.ca",
"favorite_colors": ["red", "yellow", "blue", "orange"],
},
{
"name": "Clementine Joseph",
"email": "hendrerit@aol.co.uk",
"favorite_colors": ["yellow", "aqua", "black"],
}
]
friends = [
{
"name": "Connor Rodriguez",
"email": "maecenas@yahoo.edu",
"favorite_colors": ["aqua", "teal", "sea foam", "turquoise"],
},
{
"name": "Rosalyn Hubbard",
"email": "elit.pharetra@google.edu",
"favorite_colors": ["red", "yellow", "black"],
},
{
"name": "Thomas Puckett",
"email": "sit.amet@aol.net",
"favorite_colors": ["blue"],
},
{
"name": "Yuli Reynolds",
"email": "augue.malesuada@google.edu",
"favorite_colors": [],
},
{
"name": "Joy Tate",
"email": "risus.a.ultricies@hotmail.org",
"favorite_colors": ["white", "grey", "sand"],
},
{
"name": "Prescott Price",
"email": "cursus.nunc@yahoo.edu",
"favorite_colors": ["red", "blue", "green"],
},
{
"name": "Josephine Keller",
"email": "nulla@protonmail.edu",
"favorite_colors": ["black"],
},
{
"name": "Isadora Carney",
"email": "sagittis.lobortis@protonmail.co.uk",
"favorite_colors": ["aqua", "lime"],
},
{
"name": "Jelani West",
"email": "vehicula.pellentesque.tincidunt@yahoo.org",
"favorite_colors": ["grey", "beige", "tan"],
},
{
"name": "Gay Pittman",
"email": "etiam.bibendum@yahoo.org",
"favorite_colors": ["yellow"],
}
]
def count_people_who_like_color(people, color):
colorcount=0
for person in people:
if color in person["favorite_colors"]:
colorcount=colorcount+1
print(colorcount)
count_people_who_like_color(friends, "grey")