Need help with 9. More with 'for'


I really don't know what they mean by:
Write a for-loop that iterates over start_list and .append()s each number squared (x ** 2) to square_list.
I tried this as my code:

start_list = [5, 3, 1, 2, 4]
square_list = []

for x in start_list:

print square_list

But I get this error:

Traceback (most recent call last):
File "python", line 5, in



For every value in start_list, square_list is appended the square of that value. Each value is stored in "x" and it appends "x ** 2" (x squared). Finally, it sorts the list.


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