Junior — Middle
Is it possible to declare variables in Python?
sobes.tech AI
Answer from AI
In Python, variables do not need to be explicitly declared with a type — they are created automatically when assigning a value. The type of a variable is determined dynamically at runtime and can change.
For example:
x = 10 # variable x of type int
x = "text" # now x is a string
Thus, in Python, variables exist as names associated with objects in memory, and there is no need to declare them in advance.