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


#1



https://www.codecademy.com/en/courses/python-beginner-en-pwmb1/1/5?curriculum_id=4f89dab3d788890003000096#


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!


#2

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

for item in my_list:

or,

for x in my_list:

#3

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

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

Again im gettin error


#4

first line is my.. not y. =D


#5

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

print x ** 2

#6

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

for x in my_list:
    print x ** 2

My result is
1
81
9
64
25
49
None

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


#7

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

#8

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