Computer Science
What is the difference between implicit type conversion and explicit type conversion?
Python Data Handling
259 Likes
Answer
Implicit Type Conversion | Explicit Type Conversion |
---|---|
An implicit type conversion is automatically performed by the compiler when differing data types are intermixed in an expression. | An explicit type conversion is user-defined conversion that forces an expression to be of specific type. |
An implicit type conversion is performed without programmer's intervention. | An explicit type conversion is specified explicitly by the programmer. |
Example: a, b = 5, 25.5 c = a + b | Example: a, b = 5, 25.5 c = int(a + b) |
Answered By
138 Likes
Related Questions
Given str1 = "Hello", what will be the values of:
(a) str1[0]
(b) str1[1]
(c) str1[-5]
(d) str1[-4]
(e) str1[5]
What is an atom in Python? What is an expression?
Are these values equal? Why/why not?
- 20 and 20.0
- 20 and int(20)
- str(20) and str(20.0)
- 'a' and "a"
Two objects (say a and b) when compared using == ,return True. But Python gives False when compared using is operator. Why? (i.e., a == b is True but why is a is b False?)