COMMENTS, IDENTIFIERS AND KEYWORDS IN PYTHON
COMMENTS
Python allows you to add comments in the code as other programming
languages do. Comments are used by the programmer to explain the piece of code
to others as well as to himself in a simple language. Every programming
language uses special character for commenting, so does Python.
Python uses hash character (#) for comments. Putting #
before a text ensures that the text will not be parsed by the interpreter.
Comments do not affect the programming part and the Python interpreter does not
display any error message for comments. Comments show up as it is in the
programming. It is a good practice to use comments for program documentation in
your program so that it becomes easier for other programmers to maintain or
enhance the program when required.
A Python identifier
is the name given to a variable, function, class, module or other object. An
identifier can begin with an alphabet (A –Z or a -z),
or an underscore (_) and can include any number of letters, digits, or
underscores. Spaces are not allowed.
Python will not accept @, $ and % as
identifiers. Python is a case sensitive language. Thus, Hello and hello both are
different identifiers.
Example of identifiers:
KEYWORDS
Python
has a list of reserved words known as keywords. Every keyword has a specific
purpose and use.
A
list of reserved keywords in Python.
Comments
Post a Comment