beginnerPython
Previous
What is the difference between implicit and explicit type conversion?
Next
What does the None value represent?
Can a Python variable change its data type?
Answer
Clear, interview-ready explanation
Yes. Python is dynamically typed, so the same variable can refer to objects of different data types at different times.
Example:
value = 100
print(type(value))
value = "Python"
print(type(value))
value = True
print(type(value))
Output:
<class 'int'>
<class 'str'>
<class 'bool'>
Technically, the variable itself does not have a fixed type. The object referenced by the variable has a type, and the variable can be reassigned to another object.
Although this is allowed, frequently changing a variable’s meaning or expected type can make code harder to understand and maintain.