Passing a list into the function


#1



Replace this line with your code.


#2

Hi

Please post your question and your code so we can suitably help you :slight_smile:


#3

When i am trying to run this code in python shell 3.5 it says syntax error

def list_function(n):
	return n
n=[5,4,3]

SyntaxError: invalid syntax


#4

I will need a bit more info. What exactly are you trying to do and in relationship to what exercise?


#5

this exercise was "passing a list into the function" it ran into codeacademy well but when I am trying to run in python shell it is not running

Thanks in advance NIK :slight_smile:


#6

Is that your full code. I'm guessing that you probably have a print somewhere, whose syntax is a bit different in python 2.x vs in python 3.x:

Python 2.X

print 'something'

Python 3.X

print('something')


#7

ya mine is 3.5 ,ya that was my full code,it was same as in the exercise in "Passing a list into the function"

this is mine

def list_function(n):
	return n
n=[5,4,3]

after entering the list it tells "syntax error"


#8

Can you post a printscreen, because nothing's wrong with your code?