0% found this document useful (0 votes)
19 views7 pages

Components of A Python Program

This presentation will educate about Components of Python Program, Literals in Python, Identifiers in Python, Variables in Python, and Constants in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views7 pages

Components of A Python Program

This presentation will educate about Components of Python Program, Literals in Python, Identifiers in Python, Variables in Python, and Constants in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

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

reserved Blocks and


words Indentations
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 Special Symbols are


Underscore - (_) not allowed - ($,#,@)
Alphabets Capital(A to Z)
and small (a to z)
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

You might also like