[13/19] What's wrong with my code?


#1

Hello guys! :smiley:

Please help me, whats wrong with this code:

numbers = [7, 9, 12, 54, 99]

print "This list contains: "

for num in numbers:
    print num

# Add your loop below!
for x in numbers:
    x = numbers ** 2
    print x

Any correction would be very helpful! Thanks a lot! :wink:


#2

You are reassigning x inside the for loop. You should just past the result of numbers**2 to the print method.
Remember, never use a variable you declare in for variable in something.


#3

this code works

numbers  = [7, 9, 12, 54, 99]

print "This list contains: "

for num in numbers:
    print num

# Add your loop below!

for num in numbers:
    print num ** 2

#4

Very simple, thank you!