Dynamic Typing in Python

In Python, variables do not need to be declared with a specific data type. The data type is inferred from the value assigned to the variable and can change as needed during the program.

For example:

x = 10          # 'x' is initially an integer
print(type(x))  # Output: <class 'int'>
 
x = "India"     # 'x' is now changed to a string
print(type(x))  # Output: <class 'str'>