Skip to content

Commit a61b1af

Browse files
committed
Use global variables
1 parent c6f8dc4 commit a61b1af

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

func_global.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/python3.1
2+
# Filename : func_global.py
3+
4+
def func():
5+
global x
6+
7+
print('x is ', x)
8+
x = 2
9+
print('Changed local x to ', x)
10+
11+
x = 50
12+
func()
13+
print('Value of x is ', x)

0 commit comments

Comments
 (0)