The general agreement is to define variables with capital and underscores and not change them. How,
GRAVITY = 9.8
However, it is possible to create constants in Python using namedtuple
import collections Const = collections.namedtuple('Const', 'gravity pi') const = Const(9.8, 3.14) print(const.gravity)
For namedtuple refer to the docs here
source share