"ISAAC Ramírez Solano" <danielramso...@hotmail.com> wrote
Hi... My name is Isaac, I need some help to program in python,
I know some things that are really basic like lists and recursivity
I'm not sure what you mean by recursivity, but I'm betting its
not what I mean by that term! :-)
with that we should create an GPS with a global variable,
I'm also not sure what you mean by GPS - to me that
means Global Positioning Satellite but I suspect you mean
something different?
what I'm trying to do is to make a function that could call
the global variable can I do something like that...
Yes and any Python tutorial will explain how.
You can try the Modules and Functions topic in my
tutorial if you are not already reading another one.
[ If your first language is Spanish or Portuguese you
may prefer the translations in those languages better.
(But they are only available for Python v2) ]
def function(Word): Word = Word Word= [Word] print (Word)
Thats not legal python, it may just be a formatting error. Lets assume
so, it would then look like:
def function(Word):
Word = Word
Word= [Word]
print (Word)
That creates a list containing the parameter passed in and
then prints it. It then throws it away.
if I execute that in the shell later I'm not able to call
Word because it returns me an error!!!
That would depend on whether you created Word before you
called the function. I suspect you are confused about
Python variables, Python scope, and Python functions.
Read about those topics and then come back with any
further questions.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor