#9 More with 'for'


#9 More with 'for'

I keep getting an error that is not making sense to me. it says the length of the two arrays are different. please see the screenshot, It shows they are the same length.

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

# Your code here!
for number in start_list:
    n = number**2

print squared_list
print "-----tests below-----"
print "start_list= " + str(start_list)
print "size of start_list and squared_list: " + str(len(start_list)) + " vs " + str(len(squared_list))


what a weird error message, the only problem seems to be you used the wrong variable (squared_list, while the exercise wants you to use square_list)

If more help is needed, post an updated version of your code


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