You are on page 1of 18

Full stack web development using python

Variables and types

Saurabh Shukla (MySirG)


- Agendas
① Comments

② Data

③ variables

⑥ Dynamic Type
⑤ type C)
⑥ Data Types
⑦ Memory Management
⑧ printer )
⑨ special characters .
Comments

line comment # Text



Single .
. .

→ Multi line comment " " "

E
" ""
Data
Data is any piece of information which is
used by the to accomplish a task
program
.

Examples of tasks
→ Find sum of two numbers
check whether number is even
→ a
given
or odd
find numbers
→ LCM of two .

All the above tasks can be done only

by using some data


varietyafdatuag.ee
of a

}
person 25

ATM PIN Integers 0007

Number of students 250

price of a book 450.8°

body weight 68.5


} Real

}
"
"

city name BHOPAL


"
Saurabh
"
strings
person name
"

Python bible
"

book title
variables
hold data
• Variables are used to
during
execution of the program .

declare variables

In C ,
C++
,
You need to .

them
Only after declaration you can use .

int a;

float b ;

don't declare variables



In Python you .

If there is a need of a variable


and start
think of a name
you
it a variable
using as
clctt Python Automatic
declare
inta ; ← 9=5
← declaration
a
a=5 :

att :

printfc t.cl
" "
a),
i
9=9+5

9=7 ;
variabk.name
variable is combination
• name
any
and underscore
of alphabet , digit .

• variable name cannot start with digit .

are case sensitive


variable names
.

variable
cannot be used as

Keywords
names .
✗ = 10

del se

c / C + t / Java
statement I←
semicolon
Dynamite
Not variable may
-

only the value of a

execution
change during program
well
but the type as .

2C =

: :
÷ : : :: : :÷
5.7 # type of
x is float

" "
A- type of x is SI
✗ =
My Sir G
5-8%9%-1
""

9=5
☐ ☒

÷
idcadf.TT?ea--
9--6 412836 ←

☒☐
3.4
210142

}
int
float datatypes
boot classes
Str ⑧
C)
type

type c) is a predefined function

which returns the data type of a


variable
specified
✗= 5-

(x )
type
2--5.7
type (x)

is always a class in Python


data type
Data Types
-

- Numbers
int
5
3. 7
float
complex 3+45

Boolean
boot True
false
" ""
" ""
Mysia
String
/
"

iimys.gg ' ' '

my SNG
"'
'
Str MySirG

double is not there in Python


Char is not there in Python
Memory Management
Namespace -

Stack Private Heap space


20-5
☐ ← Garbage
Y

→☒z
block = 2.5

E- 6

>

x
del ;
-
Garbage -
Collection

It is invoked
a
program ,
by Python
itself ,
whenever required ,
whose
job
is to release of
memory
Garbage
blocks ( object which is not referenced
by any
name )
whutisanobjecl-9.object.is read world entity

Object is an instance of a

class

object is a
proper noun


class is a common noun

→ common noun class


Doctor

Dr dixit →Proper noun object


→ Proper noun object
.

Dr Sharma
.
Name%a2-eari-s.IT?
Name in namespace is a variable which
is used to contain id( reference) of

µ
① Instance object >
☒%:¥¥

② Function object '_☐→☐%Eeu


in .

Function
③ class object Print ☐
> object

In Python everything is an object .


print C)
( welcome )
-

" "


print simple text point
print ( )
x
variable value

print )
( x -15*3

print expression print
value print ( X , Y)
*
print multiple
o
Sep
• end

You might also like