Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3 . 2 0 LAB: List basics Instructor note: Reminders: to create a list: the _ list = ' [ one , two, three ]
LAB: List basics
Instructor note:
Reminders:
to create a list: thelist one two, three
to combine concatenate lists: onelist twolist
to add thing to a list: thelist.append thing
to find the position index of thing in a list: thelist.index thing
to assign something to an index of a sequence string or list: thelist index thing
to remove an element from a list: thelist.remove thing
to remove an element from a list and assign it to a variable: result thelist.pop index
Given the user inputs, complete a program that does the following tasks:
Define a list, mylist, containing the user inputs: myflower myflower and myflower in the same order.
Define a list, yourlist, containing the user inputs, yourflower and yourflower in the same order.
Define a list, ourlist, by concatenating mylist and yourlist.
Append the user input, theirflower, to the end of ourlist.
Replace myflower in ourlist with theirflower.
Remove the first occurrence of theirflower from ourlist without using index
Remove the second element of ourlist.
Observe the output of each print statement carefully to understand what was done by each task of the program.
Ex: If the input is:
rose
peony
lily
rose
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