9/14 More with 'for'


#1

hello guys, i was trying to get this done, but I was getting an error. i had this code.

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

# Your code here!
for numbers in start_list:
    square_list.append(number ** 2)
    square_list.sort()
    
print square_list

but didnt work, I gave up and got the code done for me and it was this:

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

# Your code here!
for number in start_list:
  square_list.append(number ** 2)
square_list.sort()

print square_list

why indentation of .sort is not as the .appended ???


#2

This is done in the wrap-up phase, where it belongs.


#3

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