Python syntax defines a set of rules that are used to create Python statements while writing a Python Program.
Case sensitivity in Python-ย
Case sensitivity in Python is applicable as python is a case sensitive programming language.
Indentation in Python-
Indentation in Python is used to indicate a block of code, all statements within the block must be indented the same amount.
Identifiers in Python-
Identifier in Python is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9). Here are naming conventions for Python identifiers โ
โขPython Class names start with an uppercase letter. All other identifiers start with a lowercase letter.
โขStarting an identifier with a single leading underscore indicates that the identifier is a private identifier.
โขStarting an identifier with two leading underscores indicates a strongly private identifier.
โขIf the identifier also ends with two trailing underscores, the identifier is a language-defined special name.
Comments in Python-
Comments start with a #, and Python will render the rest of the line as a comment.
Quotations in Python-
Python accepts single (โ), double (โ) and triple (โโ or โโโ) quotes to denote string literals, as long as the same type of quote starts and ends the string.
Keywords in Python-
Keywords in Python are reserved for use in python language construct and should not be used as variable, constant or any other identifier name. List of these words are available by executing following command โ
>>> import keyword
>>> print(keyword.kwlist)
Multi-Line Statements in Python-
Multi-line statements in Python is allowed by, usingย \ย at the end of the line, or writing statements in [],{}or () brackets. A Statement in Python ends with a new line or semicolon.
Leave a Reply