3.10 LAB: List basics
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_flower3 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
daisy
aster
the output is:

['rose', 'peony', 'lily', 'rose', 'daisy']
['rose', 'peony', 'lily', 'rose', 'daisy', 'aster']
['rose', 'aster', 'lily', 'rose', 'daisy', 'aster']
['rose', 'lily', 'rose', 'daisy', 'aster']
['rose', 'rose', 'daisy', 'aster']

Respuesta :

The program is an illustration of Python lists; lists are used to hold multiple values in a variable

The main program

The program written in Python, where comments are used to explain the code is as follows:

#This gets all required outputs

my_flower1 = input(); my_flower2 = input(); my_flower3 = input(); your_flower1 = input(); your_flower2 = input(); their_flower = input()

# This defines my_list and appends the values of my_flower1, my_flower2, and my_flower3

my_list=[my_flower1,my_flower2,my_flower3]

# This defines your_list and appends your_flower1 and your_flower2

your_list=[your_flower1,your_flower2]

# This defines our_list by and concatenates my_list and your_list

our_list = my_list+your_list

#This prints our_list

print(our_list)

# This appends their_flower to the end of our_list

our_list.append(their_flower)

#This prints our_list

print(our_list)

# This replaces my_flower2 in our_list with their_flower

our_list[our_list.index(my_flower2)]=their_flower

#This prints our_list

print(our_list)

#This removes the first occurrence of their_flower from our_list

our_list.remove(their_flower)

#This prints our_list

print(our_list)

#This removes the second element of our_list

our_list.remove(our_list[1])

#This prints our_list

print(our_list)

Read more about python lists at:

https://brainly.com/question/16397886