Home >>Python Keywords >Python def Keyword

Python def Keyword

Python def Keyword

Python def keyword is used to create or define any desired function in the program.

Here is an example of Python def keyword:

def my_function():
print("Hello World")
my_function()

Output:
Hello World
Example 2:

def my_function():
 print("Hello World")
my_function()
def new_function():
 print("My name is Jerry")
new_function()

Output:
Hello World
My name is Jerry

No Sidebar ads