How to pass a list as an argument in python -


i new python , coding in c++ 2 years. want pass list argument in function display stuff inside in different lines (actually want make own function display stuff)

myvar = [1, 4, 5, 3, 7, 4, 9, 5, 10]  def displaylist(paramlist):     tempindex = 0     in paramlist:         print paramlist[tempindex]         tempindex += 1  displaylist(myvar) 

this wrote , getting this:

1 4 5 3 7 4 9 5 10 

this not expected output. have done wrong.

note: new language.

edit: apologize inconvenience showed exact output wanted, didn't notice because of negligence. please flag question gets deleted

this looks expected output me. note bit more pythony way write code might be

myvar = [1,4,5,3,7,4,9,5,10]  def displaylist(paramlist):     p in paramlist:         print p  displaylist(myvar) 

Comments

Popular posts from this blog

command line - Use qwinsta in PowerShell ISE -

java - Incorrect order of records in M-M relationship in hibernate -

Python website log in: BIG-IP can not find session information in the request -