(For one and all.). how to print it



Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: invalid syntax (python, line 4)

my_list = [1,9,3,8,5,7]

for 9 in my_list:
    print my_list = my_list ** 2

basically, i dont understand this exercise. Please help me!


9 is a number literal and not a variable. Try using a generic text name:

for item in my_list:


for x in my_list:


y_list = [1,9,3,8,5,7]

for x in my_list:
    print my_list = x**2

Again im gettin error


first line is my.. not y. =D


We are not making an assignment. Simply print the item...

print x ** 2


my_list = [1,9,3,8,5,7]

for x in my_list:
    print x ** 2

My result is

My error is
Oops, try again. It looks like your loop did not print 2!


When in doubt, re-read the instructions...

Write a statement in the indented part of the for-loop that prints a number equal to 2 * number for every list item.

for x in my_list:
    print x * 2


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.