In Python, constants are usually declared and assigned on a module. Here, the module means a new file containing variables, functions etc which is imported to main file. Inside the module, constants are written in all capital letters and underscores separating the words.
Create a constant.py
PI = 3.14
GRAVITY = 9.8
Create a main.py
import constant
print(constant.PI)
print(constant.GRAVITY)
When you run the program, the output will be:
3.14 9.8