Skip to main content

Python: Explicit Type Conversion

In Python, this method is need user involvement to convert the variable data type into certain data type in order to the operation required. This type of conversion is also called typecasting because the user casts (changes) the data type of the objects.

Mainly in type casting can be done with these data type function:

  • Int() : Int() function take float or string as an argument and return int type object.
  • float() : float() function take int or string as an argument and return float type object.
  • str() : str() function take float or int as an argument and return string type object.


a = 4
num = float(a)



<class 'float'>
Submitted by devanshi.srivastava on July 1, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.