Python’s constant naming convention is to use all uppercase letters and underscores to separate words. This is not enforced by the language itself, but it is a convention that is widely followed by the Python community or other programming languages.
MAX_CART = 10
Python does not have a true constant data type, so you can technically reassign a value to a variable defined as a “constant”. However, following the convention of using all uppercase letters and underscores to name constants can help indicate to other developers that the variable should not be modified.
Python constant naming convention examples
Simple example code naming convention in Python for variable and function.
SCHOOL_NAME = "GLOBAL INT"
David Goodger (in “Code Like a Pythonista” here) describes the PEP 8 recommendations as follows:
joined_lowerfor functions, methods, attributes, variables
camelCaseonly to conform to pre-existing conventions
Do comment if you have any doubts or suggestions on this Python basic topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.