Python program to create function inside a function

A Python program to create function inside a function. In this program we can print the string using function inside a function. A set of instructions in Python is called a function. To run the code of a function, you must call it. To return a value from a function, use the return statement. Functions are a feature shared by all programming languages. They allow programmers to write code blocks that perform certain tasks.

x = "welcomes you"
def myfunc():
x = "welcomes you"
print("Python " + x)
myfunc()
print("Python " + x)

 

Output:

Python welcomes you
Python welcomes you