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
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
