Creating a simple Function in python || python code for creating function

← Back to Home

🔹 Functions in Python

A function is a block of code which only runs when it is called.

we can pass data, known as parameters, into a function.

A function can return data as a result.


# In Python a function is defined using the def keyword:

🔸 Example : Creating a Function

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



🔸  Calling a Function

To call a function, we use the function name followed by parenthesis

 Example :


def my_function():
  print("Hello from function")

my_function()    # Here is Function call by its name


No comments:

Post a Comment

Featured Post

Master MongoDB with Node.js Using Mongoose: Complete Guide

Working with MongoDB from Node.js using Mongoose Your Magical Mongoose Pet That Makes MongoDB Super Easy For Beginner to Expert Level ...

Popular Posts