Professional Documents
Culture Documents
04_04_lists completed Fop
04_04_lists completed Fop
04 Lists
Write a program to ask the user for their favorite item in a given category. Then provide feedback if their
item is on your list. Use the following guidelines to write your program.
1. Pick a category and make a list of your five favorite things. Suggested categories include your
favorite: actors, books, cars, or something else of your choosing.
2. Ask the user what their favorites are in your selected category.
3. By creating a list, a loop, and if statements, print a message that lets the user know if their
favorites matches the ones on your list.
4. Neatly print your entire list to the screen. Be sure to number each item.
5. Write the pseudocode for this program. Be sure to include any needed input, calculations, and
output.
Insert your pseudocode here:
Example of expected output: The output for your program should resemble the following screen shot.
Your specific results will vary depending on the choices you make and the input provided.
def main():
# Dhruv Gupta
# Date: 7/3/2024
# Loop through the list of favorite car brands and check if there's a match
for brand in favorite_car_brands:
if(user_favorite_brand == brand):
is_favorite = True
main()
Part Three: Post Mortem Review
Complete the Post Mortem Review (PMR). Write thoughtful two to three sentence responses to all the
questions in the PMR chart.
Review Question Response
What was the purpose of your program? The purpose of my program was to ask the user for
their favorite car brand and check if it matches any
of the car brands on my list of favorites.
How could your program be useful in the real This program can be an icebreaker in a social
world? setting, helping people find shared interests in car
brands and starting conversations about cars.
What is a problem you ran into, and how did you One challenge I had was making sure that
fix it? is_favorite accurately showed if the user's favorite
car brand matched any brand in the list. To fix this,
I carefully checked each brand in the list against
the user's input without stopping early. This
approach ensures a thorough check and correctly
determines if the user's favorite matches any of
the stored brands, making sure the program gives
the right output reliably.
Describe one thing you would do differently the Next time, I would add functionality to handle
next time you write a program. multiple favorites from the user. I would also
compare each one to the list and provide specific
feedback for each match.