Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Types of variables


x :int = 0

x = 2
print(x)

x = "hello"
print(x)

python variables.py

2
hello

mypy variables.py

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)