bananaa22 bananaa22
  • 26-02-2021
  • Computers and Technology
contestada

Given a list of numbers, use a while loop to print the square of each element in python.
Start of with: list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
ILL GIVE 50 POINTSSS

Respuesta :

Ultrabeast5121
Ultrabeast5121 Ultrabeast5121
  • 26-02-2021

Answer:

list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

counter = 0

lenlist = len(list) - 1

while counter < lenlist :

num = list [lenlist]

squ = num * num

print (squ)

counter += 1

Explanation:

as it goes through the list, it takes the element with that index and squares it, printing the squared number. it then increments the counter and starts again with the next element in the list.

Answer Link

Otras preguntas

HELP PLZZZ )Which of the following actions was considered illegal as a result of the Sedition Act of 1918? interfering with trade between allies traveling to an
Following the stock Market Crash of 1929, Americans went through the worst depression this country has ever seen. True False
Liberal leaders wanted to change new deal programs by
84/144 to the lowest terms
What is a protagonist?
The Russian-Japanese War was caused by Russian troops remaining in Manchuria after the Boxer Rebellion. True False
Whose abolitionist novel, published in 1852, “started this big war”? Barton Lincoln Stowe Tubman
When the United States entered World War I, it supported the military efforts of which of these pairs of nations? Turkey and Italy Russia and Poland Britain and
What was President Johnson's broad program of domestic policies called? New Frontier Great Society War on Poverty New Deal
how did the U.S. government promote domestic businesses and industries?