Types of variables



examples/types/variables.py
x :int = 0

x = 2
print(x)

x = "hello"
print(x)

python variables.py


2
hello

mypy variables.py


examples/types/variables.mypy
variables.py:7: error: Incompatible types in assignment (expression has type "str", variable has type "int")
Found 1 error in 1 file (checked 1 source file)