Advertisements
Advertisements
प्रश्न
Explain the difference between explicit and implicit type conversion in Python with a suitable example.
अंतर स्पष्ट करें
स्पष्ट कीजिए
Advertisements
उत्तर
Implicit Conversion: Python automatically converts one data type to another.
Example:
x = 10
y = 3.5
result = x + y # x is implicitly converted to float
Explicit Conversion: The user manually converts one data type to another using functions like int(), float().
Example:
x = "10"
y = int(x) # Explicit conversion from string to integershaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
