9. More with 'for'


#1

I don`t know which part I wrong.
Please help me



Replace this line with your code.


#2

The instruction say ;
Write a for-loop that iterates over start_list and .append()s each number squared (x ** 2) to square_list.
Then sort square_list!

so you didn't square each number
you can use this function .sorted() to sort a list


#3

The error is due to assigning the result of append to square_list in line 6. Remove the assignment and it will work.


#4

Okay! I got it!!!
Thanks a lot :slight_smile:


#5

I got it ! thank you so much! :slight_smile:


#6

You wrote square as sqare :slight_smile:


#7

The following code works:-
start_list = [5, 3, 1, 2, 4]
square_list = []

Your code here!

for s in start_list:
square_list.append(s**2)
square_list.sort()

print square_list