Professional Documents
Culture Documents
This Assignment Has Three Parts. Part One: Programming
This Assignment Has Three Parts. Part One: Programming
This Assignment Has Three Parts. Part One: Programming
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:
Def main():
Define favorite sports:
Input user favorite sport
Elif of all responses to the user input
Print responses and list
Main()
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():
if (userFavSport == favSports[0]):
print("Really? " + favSports[0] + " is the best sport in the world, in my opinion!")
print("I love " + favSports[1] + "! What is the best wave you've ever caught?")
print ("My favorite team in " + favSports[3] + " is the Los Angeles Lakers. What's your's?")
print ("I used to play " + favSports[4] + " all the time, but I don't play it as much anymore. Also,
technically, chess is a sport.")
else:
print("Interesting, my friend actually plays " + userFavSport + ", maybe you guys will be great
friends!")
print ("")
main()
What was the purpose of your program? To compare the user input to the coder’s preset
choices and display responses that compare the
data from both sides.
How could your program be useful in the real This program can be used in a variety of ways,
world? such as to compare recent business performances
to the past, sports statistics, and more.
What is a problem you ran into, and how did you I used a long variable name for one of my
fix it? variables, so I changed it to a simplified version
that was easier to type but was still identifiable to
an outside viewer.
Describe one thing you would do differently the Next time, I would use different categories and
next time you write a program. subjects to compare data with.