Need help with 9. More with 'for'


#1

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:
    start_list.append()
    square_list.sort()


print square_list

But I get this error:

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

HELP


#2

Explanation:
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.


#3

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