Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 2 Write code that builds a list of a user's favorites things. Do the following: 1. Initialize a variable to an empty list 2.
Problem 2 Write code that builds a list of a user's favorites things. Do the following: 1. Initialize a variable to an empty list 2. Iterate continuously using while: A. Accept a input from the user. B. If the user input is equal to none or None: a. Terminate the loop C. Append the user input to the list. 3. Print the list []: favthings =[] while True: word=input("What's your favorite thing?") if word=="none" or word=="None": break favthings.append(word) print("Your favourite things is: ", favthings) Sample input and output: Given the input below: Input a favorite thing of yours, 'None' or 'none' to exit: books Input a favorite thing of yours, 'None' or 'none' to exit: movies Input a favorite thing of yours, 'None' or 'none' to exit: none The expected output is: ['Books', 'Movies']
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started