Oops try again! square list needs to be the same length as start list


#1

i tried this

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

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

it says that square list needs to be the same length as start list
pls help


More with 'for' #9
#2

@beboch Because of that break, your loop stops on the first iteration, and is able to insert only one element, that's why square_lists length (1) doesn't equal start_list's length (5)


#3

Ok thank you, it works now :slight_smile: