← Go Back

How to Create a Constant

There are no constants in Python as in other languages. However, to indicate that an object will not (or should not) change at runtime, you can follow the convention of naming it using UPPER_CASE_WITH_UNDERSCORES:

Example:

# Simulates a constant.
PYTHON_VERSION = "3.12.0"

This is a well-estabilshed convention among Python programmers.

constants