# Can we explicitly define datatype in a Python Function?

PythonServer Side ProgrammingProgramming

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

In Python, variables are never explicitly typed. Python figures out what type a variable is and keeps track of it internally. In Java, C++, and other statically-typed languages, you must specify the datatype of the function return value and each function argument.

If we explicitly define datatype in a python function, it still works like a normal program where data type is not declared explicitly.

## Example

We get the following output for the given code

C:/Users/TutorialsPoint1/~.py
The required Sum is:  13.0

Consider this function

def addSum(x,y):
return x+y
print addSum(float(2.2), float(5.6))
7.8
7.8