+ 1
How do I declare and unchangeable variable in python?
2 Answers
+ 3
I support the statement declared by Thirt13n.
Instead, you can create a different file of all constants and import it into your code.
Like, make a file constants.py
which has code as follows :-
PI = 3.141..
A = 10
Now,import this constants.py to any of your codes where you wanna use those constants.
Ex:-
import constants
print(constants.PI) #3.141..
print(constants.A) #10
Hope you got it!!
+ 2
Hey Chinonso Ozumba đłđŹ
You can't declare a variable or value as constant in Python. Just don't change it.