Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

By using Python 3.6 : - Write a script called basket.py that repeatedly asks the user to enter an item to be placed in a

By using Python 3.6:

image text in transcribed

- Write a script called basket.py that repeatedly asks the user to enter an item to be placed in a basket. When the user enters nothing (case insensitive), the script should stop asking for new items and display a message listing the items and stating how many items there are. There is a way of doing this with tuples (and concatenation and reassigning variables), but this assignment is about learning how to work with lists, so I'm adding the following requirement: Your script must store the strings that the user has input in a list, and you must use .append( ) to add to the list. Here's what it might look like: Add as many items to the basket as you want. When you're done, enter 'nothing'. What do you want to put into the basket now? a sandwich Okay. What do you want to put into the basket now? two cans of Dr Pepper okay. What do you want to put into the basket now? some napkins Okay. What do you want to put into the basket now? nothing There are 3 items in the basket: ['a sandwich', 'two cans of Dr Pepper', 'some napkins'] Your results don't have to look exactly like this, but they should include instructions, a prompt to ask for each input, and some kind of summary at the end that indicates the number of items in the basket and that lists all the items in the basket

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_2

Step: 3

blur-text-image_3

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions