Response:
The following is a program written in Python.
#Initialize a list variable and set its elements
myPizza = ['Margarita', 'Capsicum and onion', 'Chicken']
#Create a variable and duplicate the elements
frndPizzas = myPizza[:]
#Add an item to the list
myPizza.append('Corn')
#Add an item to the friend's pizza list
frndPizzas.append('paperica')
#Display a message
print("My pizzas are:")
#Use a for loop to display the elements of the first list
for pizza in myPizza:
print(pizza)
#Display another message
print("\nFriend's pizzas are:")
#Use a for loop to display the elements of the second list
for frndsPizza in frndPizzas:
print(frndsPizza)
Output:
My pizzas are:
Margarita
Capsicum and onion
Chicken
Corn
Friend's pizzas are:
Margarita
Capsicum and onion
Chicken
paperica
Explanation:
This program can be summarized as follows:
- Define a list variable called 'myPizza' and initialize it.
- Define another list variable called 'frndPizzas' and duplicate the items.
- Add elements to both lists.
- Utilize for loops to print items in each list.