[clue] python (function return array) [programming]
Mike Bean
beandaemon at gmail.com
Tue Dec 27 19:18:25 MST 2011
OK, I'm pretty sure this is a fairly novice question, but I'm working a
project on my own and my attempts to suss the solution have met with
limited success.
I'm writing mostly similar code over and over again, bad me. But I have to
be able to return a list/array, and I don't know if return statement can
handle more then just a single variable. So for example, I realize your
generic scenario is
def function()
variable="whatever"
return(variable)
newvar=function()
print("newvar")
but I want to know is what's wrong with my logic in this sense:
def function()
my_array=[1,2,3]
return(my_array)
new_array=[(my_array)]
for x in new_array:
print(x)
testing has met with no success obviously. I'm assuming it's because an
array is not the same thing as a generic variable. In any case, any
suggestions/guidance from folks with experience in programming/python is
appreciated.
Bean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20111227/473df006/attachment.html
More information about the clue
mailing list