beginnerPython
Previous
How do you check the type of a variable?
Next
What is the difference between implicit and explicit type conversion?
What is type conversion in Python?
Answer
Clear, interview-ready explanation
Type conversion is the process of converting a value from one data type to another.
Python provides built-in functions for explicit type conversion, including:
-
int() -
float() -
str() -
list() -
tuple() -
set() -
bool()
Example:
number = "100"
converted_number = int(number)
print(converted_number)
print(type(converted_number))
Output:
100
<class 'int'>