From f8ba1f57eacefd0886ae2adbdcdd5c89d8f5a9ef Mon Sep 17 00:00:00 2001 From: Rajani Kanta Panda <49396418+rkantapanda10@users.noreply.github.com> Date: Sun, 4 Oct 2020 21:17:25 +0530 Subject: [PATCH] Closures in Python Do coding in Python for Closures --- Closures.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Closures.py diff --git a/Closures.py b/Closures.py new file mode 100644 index 0000000..c652faa --- /dev/null +++ b/Closures.py @@ -0,0 +1,12 @@ +def print_msg(msg): + # This is the outer enclosing function + + def printer(): + # This is the nested function + print(msg) + + printer() + +# We execute the function +# Output: Hello +print_msg("Hello") \ No newline at end of file