What is the error in this code?function returns only one element of the array


#1

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



def square(my_list):
  square_list=[]
  for i in my_list:
  	square_list.append(i**2)
	return square_list






print square(start_list)



#2

Check the indentation on your return line.


#3

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