A function is a block of code which is executed only when it is called. To define a Python function, the def keyword is used.
Example:
- def New_func():
- print (“Hi, Welcome to lahore”)
- New_func() #calling the function
Output:
Hi, Welcome to lahore
Education, Tools and Services