9. more with "for" I NEED HELP!


#1



These are my error messages
Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: 'list' object is not callable
Traceback (most recent call last):
File "python", line 6, in
TypeError: 'list' object is not callable


I need to write a for-loop that iterates over start_list and .append()s each number squared (x ** 2) to square_list.
Then sort square_list


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

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


#2

The above is treating square_list like a function, when it is a list. We can directly append to it, and not involve start_list.

   for number in ...:
        square_list.append(number ...)

... indicates code to fill in.


#3

Im not understanding the part
(number ...)
Wouldn't i fill in
square_list ?


#4

Nevermind.... I understand now...Thanks!


#5

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