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

How did Raphael use atmospheric perspective
Speculation and restrict used in one sentence
How to determine which atom is bigger??
show a way to count from 170 to 410 using tens and hundreds. Circle at least 1 benchmark number.
role of vitamin A in maintaining normal vision
Is the following sentence an example of a fused sentence, sentence fragment or a comma splice? "Joe eats sausages on the table, being a symbol"
Is there any great similarity between the muscle structure and muscle arrangement in the cat and humans?
What repealed the Stamp Act
if rebecca has 42 dollars and she looses 12, how much money does she have left?
How do you do this problem ?5y 9≤4?