Answered step by step
Verified Expert Solution
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:
- 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 basketStep 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