For One and All. I don't what is the error, please help!


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

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


Whar are you trying to print here? Don't use an assignment in the loop.


You're trying to print a variable and assign a value to it at the same time. Does not work. "number" is already going to run through each of the numbers in "my_list" since it's a for loop.

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

for number in my_list:
    print number ** 2


2 posts were split to a new topic: For one and all


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