What are Python Constants?
Python Constants are a value that never changes throughout the execution of a program. Unlike variables, their values cannot be changed after they are assigned. However, Python doesn’t have a built-in mechanism for declaring constants like in some other programming languages.
Instead, programmers follow naming mechanism to indicate that a variable’s value should be treated as a constant and not modified.
How to define Python Constants?
When we write a computer program to find the area and circumference of a circle, the value of π is not changed. Because π is a constant.
But there’s not a special way to define constants in python as in other programming languages.
In Python constants are defined as same as defining a variable. To separate variable definition from constant definition, python use capital letter to define constant.
But the feature “the value never change in constant” is not supported in python.
Example for Python Constants
PI=3.142