Question: Write a program that firstly creates a list and initializes it with the following numbers: 1,2,3,4,5,6 Then, use a for loop to iterate over each
Write a program that firstly creates a list and initializes it with the following numbers: 1,2,3,4,5,6 Then, use a for loop to iterate over each element by their index numbers, and raise each element to the power of 2 (modify each element's value to its square). Finally, print out the modified list. [Run your program in Python IDLE to get rid of syntax errors and verify if the program works correctly as described above. Program that cannot run due to syntax error(s) will receive 0 point.] The original list is [1,2,3,4,5,6] The modified list is [1,4,9,16,25,36]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
