Skip to content

Commit

Permalink
Create VariableScope.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CogitoKunal committed Oct 26, 2024
1 parent 045ec95 commit 374b859
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Program's_Contributed_By_Contributors/VariableScope.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

x = 'Global x'

def test():
#global x
y = 'Local y'
x = 'Local x'
print(x +', '+ y) #prints 'Local x' and 'Local y'

if __name__ == '__main__':
test()
print(x) #prints 'Global x'

0 comments on commit 374b859

Please sign in to comment.