Stuck in an infinite loop in Python


#1

Hi,

I am stuck in an infinite loop for my Python coding. The title of the lesson is “More with ‘for’” (9/14).
I wrote the following code. Could anyone please help me what’s going on?

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

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

print square_list


#2

This is making the start_list longer and longer so the loop never quits.

square_list.append(...)

#3

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