Variables and Types
Variables and Types
python
Every object has:
Creating a program A. An identity which can be
often requires storing known using an is
(object)
values as we may use it
B. A type which can be
later. Objects capture checked using the type
(object) and
the data, which can
C. A value
then be manipulated by
• Identity of the object:
the computer to furnish This defines the address
of the object in memory
information.
and is immutable once
created.
• Type : This denotes a set
of values and the
operations possible on
them.
Number
This kind of data type can store numerical and is immutable,
which means that the value of its object remains unchanged.
Sequence
An arranged group of items that are indexed by
positive integers is known as a Sequence.
Example: >>>a=8
Will create a value 8 referenced by a
a 8
Different types of Statements used in
python
Print Statement
Print computes the expression before generating it as
output to the monitor. It sequentially processes one
line for output before moving to the next. To print more
than one item on a single line, comma (,) may be used.
Example: >>>print “Hello”
Hello
>>>print 9+1
20
>>>print 41.176
41.176
Input Statement
The data that the end user types into the program is called input.
Import Statement
It is possibly the easiest and popular way of using modules in our code.
Example: >>>import math