Ticker

6/recent/ticker-posts

Typecasting in Python

 Typecasting in Python:

Type casting is a method of converting one type of data into another type of data. The types of data are integer, float and string.  There are two types of type casting

1) Implicit typecasting

2) Explicit typecasting 

Implicit typecasting:

Implicit typecasting is done automatically and there is no involvement of user in the process.

 

Implicit Typecasting

Explicit typecasting:

Explicit typecasting is done manually by the user as per the requirement.

 

Explicit type casting in Python.

Here the integer A and B are converted to float. So A becomes 5.0 from 5 and B becomes 2.0 from 2. C is float but it is converted to integer. So the value of C becomes 2 from 2.5.


Post a Comment

0 Comments