Ask Question
15 October, 23:13

More Loops: All versions of foods. py in this section have avoided using for loops when printing to save space. Choose a version of foods. py, and write two for loops to print each list of foods.

+5
Answers (1)
  1. 15 October, 23:41
    0
    Following are the program in the Python Programming Language.

    #set list type variable and initialize the elements

    myPizza = ['Margarita', 'Capsicum and onion', 'Chicken']

    #set variable and initialize the elements

    frndPizzas = myPizza[:]

    #append value in list variable

    myPizza. append ('Corn')

    #append value in list variable

    frndPizzas. append ('paperica')

    #print message

    print ("My pizzas are:")

    #set the for loop and print elements of 1st list

    for pizza in myPizza:

    print (pizza)

    #print message

    print ("/nFriend's pizzas are:")

    #set the for loop and print elements of 2st 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:

    Following are the description of the program:

    Set a list data type variable that is 'myPizza' and initializes elements in it. Set another list data type variable that is 'frndPizzas' and initializes elements in it. Append one-one element in both of the list data type variables. Set the for loops to print the elements of both list data type variables.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “More Loops: All versions of foods. py in this section have avoided using for loops when printing to save space. Choose a version of foods. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers