Python variables are typeless¶
Variable definitions are typeless
Python¶
a_variable = 1
instead of
C/C++/Java¶
int a_variable = 1
Python’s type system is dynamic
a_variable = "this is a string"
print(a_variable)
a_variable = 123 # this is a number
print(a_variable)
Python supports optional types since Python 3.5
a_variable: int = 1
but nothing forbids
a_variable: int = "this is a string"
The optional typing in Python (called type hints) is not used in this workshop.