Funciones - variables locales- globales ?
Publicado por emilio (4 intervenciones) el 29/08/2008 16:29:25
def funcion():
print a
---------------------
Programa Principal
a=5
funcion()
------------------------
Python imprime 5
HASTA AQUI, DIRIAMOS QUE A ES UNA VARIABLE GLOBAL...
PERO Y SI HAGO AHORA...
------------------
def funcion()
b= 10
c= a +b
print c
---------------
Programa Principal
a= 5
funcion()
-----------------------
Pyton me dice que en Funcion no reconoce a la variabla a
EN QUE QUEDAMOS?
Esto es un Bug?
print a
---------------------
Programa Principal
a=5
funcion()
------------------------
Python imprime 5
HASTA AQUI, DIRIAMOS QUE A ES UNA VARIABLE GLOBAL...
PERO Y SI HAGO AHORA...
------------------
def funcion()
b= 10
c= a +b
print c
---------------
Programa Principal
a= 5
funcion()
-----------------------
Pyton me dice que en Funcion no reconoce a la variabla a
EN QUE QUEDAMOS?
Esto es un Bug?
Valora esta pregunta


0