Introduction of Python
Getting Started with Python
Syntax in Python
Comment in Python
Variables in Python
Data Types in Python
Numbers in Python
Castings in Python
Strings in Python
Boolean in Python
Operators in Python
List in Python
Tuples in Python
Sets in Python
Dictionary in Python
if Else Statement in Python
While Loop in Python
For Loop in Python
Functions in Python
Lamba Function in Python
Arrays in Python
Classes and Objects in Python
Inheritance in Python
Iterators in Python
Scope in Python
Modules in Python
Dates in Python
Math in Python
JSON in Python
RegEx in Python
Try and Except in Python
User Input in Python
String Formatting in Python
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.