More with "for"


Here is my Code
start_list = [5, 3, 1, 2, 4]
square_list = []

Your code here!

for number in start_list:

print square_list

it keeps saying: "Oops, try again. Make sure to sort square_list after filling it!"

And I am confused because I looked at other posts and this seems like it would work.


you did good - try spacing ... for (for) you need spacing
for number in start_list:
print square_list


Oh thanks. I keep making stupid mistakes. And all the time I was scratching my head at other people's code because it was almost identical to mine




This statement is syntactically correct, but it does not actually perform any useful action, such as sorting square_list.


Because it does not have parentheses, the statement essentially references the name of the sort method, without causing it to execute. To sort the list, call the method, as follows ...



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