Question
This is in python! Create a function update_list that accepts two arguments -- inputList and inputStr. The function returns a list such that the second
This is in python!
Create a function update_list that accepts two arguments -- inputList and inputStr. The function returns a list such that the second through the fourth element in the inputList are replaced by the inputStr.
For example:
inputList = ["Cat", "Tiger", "Jaguar", "Leopard", "Puma"]
inputStr= "Dog"
would result in a return of:
["Cat", "Dog", "Dog", "Dog", "Puma"]
Next, create the main user interface that displays the following instructions:
This program requires a list with a minimum of 4 elements.
and presents an input
Enter the next item of the list, or 'Q' to finish:
If the user does not enter a minimum of 4 elements then display the following message and end the program.
Not enough elements in the list - quitting.
otherwise ask the user to
Enter a string:
and call your update_list function with the proper arguments. Print out the result of the function call.
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