More with 'for' unit 5, lesson 1, #9


#1

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

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

My indentation is correct, it changes for some reason
the first two lines underneath the for loop have 4 spaces

Anyways, I have no idea what to do, it says that the loop goes on forever, I don't know what the lesson even wants me to do.


#2

should be

for number in start_list:
    square_list.append(number**2)

square_list.sort()

#3

Oh, I get it, you need to append the numbers into the square list, thank you! :smile:


#4

Thank you @mtf. your clear explanation helped me as well.


#5

Thanks @mtf..Your reply helped me too.. :smile:


#7

Thanks @mtf bro works good


#8

u know i wrote the exact same thing u did and it was always wrong !!
until i copied and pasted!!


#10

thank you! @mtf this is the only solution that works


#11

2 posts were split to a new topic: Why can I put "for number in start_list:" behind "square_list.append


#12

I did the exact same thing.


#13

Thanks for the help.


#14

thank you man!!! i cant do it i do know why


#15

2 posts were split to a new topic: The meaning of square_list = [] here


#16