Kabhi-kabhi (mostly in Dynamic process) aisi condition aati ha jab hume variables ko kisi aur type me convert karna hota hai aur isi ko dhyan me rakhkar hum Casting ka use karte hain. 

Python Object Oriented Programming ke concept par kam karta hai, jiski wajah se ye har ek data types (including primitive types – int, float, str) ko define karne ke liye classes ka use karta hai.

Python me Casting, Constructor function ka use karke hota hai. Constructor Function jaise int(), float(), str().  

Integer Casting :

a = int(5)   
b = int(5.76)
c = int(“10”

O/P : a = 5; b = 5; c= 10 
means Integer Casting me har ek data type int me convert ho jayega.

Float Casting :

a = float(5)    
b = float(24.8)   
c = float(“5”)   
d = float(“5.6”

O/P : a = 5.0; b = 24.8; c= 5.0; d=5.6
means Float Casting me har ek data type float me convert ho jayega.

Str Casting :

a = str(“sr”)
b = str(6)  
c = str(6.9)
 

O/P : a = ‘sr’; b = ‘6’; c= ‘6.9’;
means Str Casting me har ek data type str me convert ho jata hai.