---
title: "Function"  
description: "Function"  
author: "Anonymous User"  
published: 2018-07-03  
updated: 2018-07-04  
canonical: https://www.mindstick.com/forum/34578/function  
category: "python"  
tags: ["python-3.4", "python"]  
reading_time: 1 minute  

---

# Function

How to create [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) in [python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python) ?

## Replies

### Reply by Prakash nidhi Verma

Python Functions :

A function is a block of code which only runs when it is called. You can pass data,which is known as parameters,into a function.

Creating a Function :

```
def my_function():   print("Hello Mindstick")
```

Calling a Function:

```
def my_function():   print("Hello Mindstick")

my_function() 
```

Passing parameters :\

```
def my_function(fname):
  print(fname + " Refsnes")
my_function("Email")
my_function("Resume")
my_function("contacts")
```

Lambda Functions:

```
myfunc = lambda i: i*2
print(myfunc(2))
```


---

Original Source: https://www.mindstick.com/forum/34578/function

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
