90 likes | 269 Views
This presentation will educate about Components of Python Program, Literals in Python, Identifiers in Python, Variables in Python, and Constants in Python.
E N D
Components of Python Program Swipe
Components of Python Program Components of any Python Program are as below:- Literals Suite Constants Comments Identifiers Python Statement Variables Expression Blocks and Indentations reserved words
Literals in Python Data or constant value stored in a variable. In the above example, constant value ’15’ is stored in a variable ’a’. 15, here is literal. 15 is integer value so it is also called integer literal. Python supports different type of literals:- Numeric Literals. Boolean Literals. Special Literal. String Literals.
Identifiers in Python A name given to a variable, function, class or object. Never use reserved words as identifier. Identifier starting and ending with __ - Language is defined as special identifier. Identifier should not start with a number. Allowed Characters Not Allowed Numbers - 0-9 Underscore - (_) Alphabets Capital(A to Z) and small (a to z) Special Symbols are not allowed - ($,#,@)
Variables in Python A variable in python is a name which may change the data associated with it over time in a program as and when required. Rules to define a variable is same as that of an identifier. It is just a name which is used to create a reference for the data or object associated with in a given program. Variable always refers to the memory location in heap where the data associated with it is stored.
Constants in Python A constant value is similar to variable with one exception that it cannot be changed once it is set. In Python, You may change the value associated with a constant. Constants in Python should use only capital letter. Do not use generic name like NUM, you may use MAX_NUM or MIN_NUM.
Topics for next Post Components of python program Data Types in Python Mutable vs Immutable Data type in Python Stay Tuned with