Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 . 2 0 LAB: List basics Instructor note: Reminders: to create a list: the _ list = ' [ one , two, three ]

3.20 LAB: List basics
Instructor note:
Reminders:
to create a list: the_list ='[one, two, three]
to combine (concatenate) lists: one_list + two_list
to add thing to a list: the_list.append (thing)
to find the position (index) of thing in a list: the_list.index (thing)
to assign something to an index of a sequence (string or list): the_list [index]= thing
to remove an element from a list: the_list.remove (thing)
to remove an element from a list and assign it to a variable: result = the_list.pop (index)
Given the user inputs, complete a program that does the following tasks:
Define a list, my_list, containing the user inputs: my_flower1, my_flower2, and my_flower 3 in the same order.
Define a list, your_list, containing the user inputs, your_flower1 and your_flower2, in the same order.
Define a list, our_list, by concatenating my_list and your_list.
Append the user input, their_flower, to the end of our_list.
Replace my_flower2 in our_list with their_flower.
Remove the first occurrence of their_flower from our_list without using index().
Remove the second element of our_list.
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
image text in transcribed

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 1 Lnai 6321

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215879X, 978-3642158797

More Books

Students also viewed these Databases questions

Question

1. Answer the question, What is human resource management?

Answered: 1 week ago

Question

Is SHRD compatible with individual career aspirations

Answered: 1 week ago