DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
Python Global variable and Local variable with same name
x
=
5
def
foo
(
)
:
x
=
10
print
(
"local x:"
,
x
)
foo
(
)
print
(
"global x:"
,
x
)
PREVIOUS
NEXT
Tagged:
#Python
#Global
#variable
#Local
#variable
ADD COMMENT
Topic
COMMENT
Name
4+9 =
Submit