Need help on 9/18 List and Functions


#1

My code isn't working at all

def list_function(x):
return x(3)

n = [3, 5, 7]
print list_function(n)

Can any body help me?


#2

x(3) isn't a thing. If you want to obtain a number from the list using the index you'll need to do x[index]. Also be aware that the index starts at 0. So to get the 2nd number from your list you need to do x[1].


#3

Hi there!

instead of:

return x(3)

It should be:

return x[1]

This is simply because the task just wants you to print the number at index 1 which in this case is 5.

Hope this helps

~NocturnalDweller~


#4

thanks for the help man!
:smile:


#5

yeah it's really working..


#6

Thanks guys.:relaxed: