Skip to content

Commit f8ba1f5

Browse files
Closures in Python
Do coding in Python for Closures
1 parent 9c89b9b commit f8ba1f5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Closures.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def print_msg(msg):
2+
# This is the outer enclosing function
3+
4+
def printer():
5+
# This is the nested function
6+
print(msg)
7+
8+
printer()
9+
10+
# We execute the function
11+
# Output: Hello
12+
print_msg("Hello")

0 commit comments

Comments
 (0)