A constant is a variable whose value should not change throughout the entire program. Python does not enforce constants, but by convention we write constant names in UPPERCASE to signal that they should not be modified:
PI = 3.14
MAX_SPEED = 150
SPEED_OF_LIGHT = 299792458
PI is clearer than 3.14 scattered throughout your codePI = 3.14
radius = float(input("Enter the radius: "))
area = PI * radius ** 2
print("The area is", area)
By using PI as a constant, the formula reads naturally: \(A = \pi r^2\)
Use UPPER_CASE with underscores for constants:
# Good constant names
TAX_RATE = 0.2
CONVERSION_FACTOR = 0.621371
MAX_ATTEMPTS = 3
# These look like regular variables — avoid this for constants
taxRate = 0.2
conversion = 0.621371