Type Conversion in Python.
🎬 *Python Type Conversion in 60 Seconds!* 🐍🔥
🔹 *Type conversion* means changing a value from one data type to another in Python. There are **two types**:
✅ *1. Implicit Conversion (Automatic)*
Python automatically converts smaller data types to larger ones.
```python
a = 10 # int
b = 2.5 # float
c = a + b # int - float
print(c, type(c)) # Output: 12.5 class 'float'
```
✅ *2. Explicit Conversion (Manual)*
We manually convert types using functions like `int()`, `float()`, and `str()`.
```python
x = "100"
y = int(x) # Converts string to integer
print(y, type(y)) # Output: 100 class 'int'
```
🚀 *Pro Tip:* Avoid converting non-numeric strings to numbers (`int("hello")` ❌).
🔥 Follow for more Python tips! #Python #Coding #Shorts