How does Python determine the data type of a variable?

x = 10 # integer
y = 3.14 # float
name = “John” # string
is_valid = True # boolean

x = 10 # integer
x = “hello” # now x is a string

Posted in Q&A