Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago