Basics of Python for Class XII Computer Science - CBSE Board

undefined
C
o
m
p
u
t
e
r
 
S
c
i
e
n
c
e
C
l
a
s
s
 
X
I
I
 
(
 
A
s
 
p
e
r
C
B
S
E
 
B
o
a
r
d
)
V
i
s
i
t
 
S
c
h
o
o
l
 
W
e
b
s
i
t
e
 
f
o
r
 
R
e
g
u
l
a
r
 
U
p
d
a
t
e
s
N
e
w
s
y
l
labus
2020-21
Chap
t
er
 
1
Re
v
i
s
io
n
 
o
f
 
t
h
e
B
as
ic
s
 
o
f
 
P
yt
h
o
n
I
n
t
r
odu
c
ti
on
It
 
is
 
wi
de
l
y
 
use
d
 
g
en
e
r
al
 
pu
r
pose
,h
igh
 
l
e
v
el
 
p
r
og
r
am
mi
ng
langua
g
e.D
e
v
el
ope
d
 
by
 
Gui
d
o
 
v
an
 
R
o
s
su
m
 
in
 
1
9
9
1.
It
 
i
s
 
use
d
 
f
or:
soft
w
a
r
e
 
d
e
v
el
o
p
me
n
t,
w
eb
 
d
e
v
el
o
p
me
n
t
 
(se
r
v
e
r
-s
i
d
e),
s
y
s
t
em
 
scr
i
p
ti
n
g
,
M
a
them
a
tics.
Visit School Website for Regular Updates
F
e
a
tu
r
es
 
o
f
 
P
y
thon
1.
E
a
s
y
 
t
o
 
us
e
 
 
D
u
e
 
t
o
 
s
i
m
p
le
 
s
y
n
t
a
x
 
r
u
l
e
2.
I
n
t
erp
r
e
t
ed
 
l
angua
g
e
 
 
Cod
e
 
e
x
e
c
ut
i
o
n
 
&
i
n
t
erp
r
e
t
a
ti
o
n
 
l
i
n
e
 
b
y
 
l
i
ne
3.
C
r
oss-pl
a
t
f
or
m
 
l
angua
g
e
 
 
It
 
c
an
 
run
 
on
wi
n
d
o
w
s,
l
i
n
ux,mac
i
n
e
t
os
h
 
e
t
c.
 
equa
l
l
y
4.
Exp
r
ess
i
v
e
 
l
angua
g
e
 
 
Les
s
 
c
od
e
 
t
o
 
b
e
 
wri
t
t
en
 
as
 
i
t
i
t
s
elf
 
e
xp
r
ess
 
the
 
pu
r
pos
e
 
o
f
 
the
 
c
ode.
5.
Com
p
l
e
t
ene
s
s
 
 
Su
p
por
t
 
wi
d
e
 
r
a
g
e
 
o
f
 
l
i
b
r
a
r
y
6.
F
r
ee
 
&
 
Ope
n
 
Sou
r
ce
 
 
Ca
n
 
b
e
 
d
o
wnloade
d
 
f
r
eely
and
 
sou
r
ce
 
c
od
e
 
c
an
 
b
e
 
mod
i
f
y
 
f
o
r
 
i
m
p
r
o
v
eme
n
t
Visit School Website for Regular Updates
Shor
t
c
om
i
ng
s
 
o
f
 
P
y
thon
1.
Lesse
r
 
l
i
b
r
ar
i
es
 
 
as
 
c
ompa
r
ed
 
t
o
 
other
p
r
og
r
ammi
n
g
 
l
angua
g
es
 
l
i
k
e
 
c
+
+,j
av
a,.n
e
t
2.
S
l
o
w
 
l
angua
g
e
 
 
as
 
i
t
 
i
s
 
i
n
t
erp
r
e
t
ed
 
l
angua
g
es,it
e
x
ecu
t
es
 
the
 
p
r
og
r
am
 
s
l
o
wl
y
.
3.
W
eak
 
o
n
 
T
y
p
e
-bind
i
n
g
 
 
It
 
no
t
 
pi
n
 
poi
n
t
 
o
n
 
us
e
 
o
f
 
a
s
i
n
gle
 
v
ariab
l
e
 
f
o
r
 
d
i
f
f
e
r
e
n
t
 
d
a
t
a
 
ty
p
e.
Visit School Website for Regular Updates
H
o
w
 
t
o
 
w
or
k
 
in
 
P
y
thon
(
i)
 
in
 
I
n
t
e
r
acti
v
e
 
mo
d
e
*
 
Sea
r
ch
 
the
 
p
ython.
e
x
e
 
f
i
le
 
i
n
 
the
 
dr
i
v
e
 
i
n
 
wh
ich
 
i
t
 
i
s
i
n
s
t
all
ed.
If
 
f
oun
d
 
dou
b
l
e
 
cli
ck
 
i
t
 
t
o
 
st
art
 
p
ython
 
i
n
 
i
n
t
e
r
a
cti
v
e
mode
Visit School Website for Regular Updates
undefined
H
o
w
 
t
o
 
w
or
k
 
in
 
P
y
thon
*
 
Cl
i
ck
 
s
t
art
 
bu
tt
o
n
 
->
 
Al
l
 
p
r
og
r
ams
 
->
p
ython<
v
e
r
s
i
on
>
->IDLE
(
P
yt
ho
n
 
GUI)
Visit School Website for Regular Updates
H
o
w
 
t
o
 
w
or
k
 
in
 
P
y
thon
P
y
t
h
o
n
 
c
o
m
m
a
n
d
p
r
o
m
p
t
 
>
>
>
Visit School Website for Regular Updates
T
y
p
e
 
t
h
e
 
f
o
l
l
o
w
i
n
g
 
a
t
 
p
r
o
m
p
t
pr
i
n
t
 
“h
e
ll
o”
pri
nt
 
8*3
pri
nt
 
3*
*
3
k=3+4*3
pri
nt
 
k
H
o
w
 
t
o
 
w
or
k
 
in
 
P
y
thon
(
ii)
 
in
 
Scr
i
p
t
 
mo
d
e
S
t
ep
 
1 
(C
r
e
a
t
e
 
p
r
og
r
am
 
f
ile)
Bel
o
w 
s
t
e
p
s
 
a
r
e 
f
or
 
s
i
mp
l
e
 
he
l
l
o
 
w
or
l
d 
p
r
og
r
am
a.
 
Cl
i
ck
 
S
t
art
 
bu
tt
o
n
->A
l
l
 
P
r
og
r
ams
 
->
P
y
tho
n
<
v
e
r
s
i
o
n
>-
>IDLE
b.
N
o
w
 
cli
ck
 
F
i
le
->N
e
w
 
i
n
 
IDLE
 
P
y
thon
 
Shel
l
N
o
w
 
ty
p
e
pri
n
t “hello”
pri
n
t “
w
orld”
pri
n
t “
p
y
thon
 
is
,
object
 
orie
nt
ed p
r
o
g
r
amming
 
lang
.
c.
C
li
ck
 
F
i
le
->S
a
v
e
 
and
 
then
 
s
a
v
e
 
the
 
f
i
le
 
w
i
th
 
f
i
l
ename
and
 
.
p
y
 
e
x
t
en
s
i
on
Visit School Website for Regular Updates
H
o
w
 
t
o
 
w
or
k
 
in
 
P
y
thon
(
ii)
 
in
 
Scr
i
p
t
 
mod
e
S
t
ep
 
2
 
(Run
 
p
r
og
r
am
 
f
il
e)
Visit School Website for Regular Updates
a.
C
li
c
k
 
Ope
n
 
c
omman
d
 
f
r
o
m
 
IDLE
s
 
F
il
e
 
menu
 
and
 
se
l
e
ct
the
 
f
ile
 
y
o
u
 
h
a
v
e
 
al
r
eady
 
s
a
v
ed
b.
C
li
c
k
 
Run
-
>
 
R
u
n
 
Modu
l
e
c.
It
 
will
 
e
x
e
c
u
t
e
 
all
 
the
 
c
ommand
s
 
o
f
 
p
r
o
g
r
am
 
f
il
e
 
and
d
i
sp
l
a
y
 
outpu
t
 
in
 
sepa
r
a
t
e
 
p
ython
 
she
ll
 
wi
nd
ow
No
t
e
 
:
-
 
P
y
thon
 
c
ome
s
 
in
 
2
 
f
l
a
v
ou
r
s
 
 
p
ython
 
2.x
 
and
 
p
ython
 
3.x
 
.
 
L
a
t
er
 
on
e
 
is
B
a
c
k
w
a
r
d
 
i
n
c
ompa
t
i
b
l
e
 
l
an
g
uag
e
 
as
 
d
e
c
i
d
e
 
by
 
P
ython
 
So
f
t
w
a
r
e
 
f
oun
d
a
t
i
on(
P
SF).
Mean
 
c
od
e
 
w
r
i
tt
en
 
i
n
 
2.x
 
wi
l
l
 
no
t
 
e
x
ecu
t
e
 
o
n
 
3.x
 
.
 
V
i
s
i
t
 
the
 
bel
ow
 
li
n
k
 
f
o
r
 
d
if
f
e
r
en
c
e
be
t
w
e
e
n
 
2.x
 
&
 
3.x
h
t
t
p
s://
w
w
w
.
g
e
e
k
s
f
o
r
g
e
e
k
s
.o
r
g
/
impor
t
a
n
t
-d
i
f
f
e
r
e
n
c
e
s-
be
t
w
e
e
n
-
p
ython-
2
-x-an
d
-
p
y
thon-
3
-
x
-w
i
t
h
-
e
x
amples/
D
a
t
a
 
Han
dli
ng
Mo
s
t
  
 
o
f
  
 
the
  
 
c
omp
u
t
er
  
 
p
r
o
g
r
a
mmi
n
g
  
 
la
ngua
g
e
supp
ort
 
 
d
a
t
a
 
 
typ
e,
 
 
v
aria
b
l
es,ope
r
a
t
o
r
 
 
and
 
 
e
xp
r
ess
io
n
 
 
li
k
e
fundam
e
n
t
als
.
P
y
thon
 
al
s
o
 
supp
ort
 
thes
e
.
D
a
t
a
 
T
yp
e
s
D
a
t
a
 
T
ype
 
sp
e
c
i
f
i
e
s
 
which
 
type
 
o
f
 
v
al
u
e
 
a
 
v
aria
b
l
e
 
c
an
 
s
t
o
r
e
.
typ
e
(
)
 
 
func
t
i
o
n
 
 
is
 
 
use
d
 
 
t
o
 
 
d
e
t
e
r
m
i
n
e
 
 
a
 
 
v
aria
b
l
e's
 
 
type
 
 
in
P
y
tho
n
.
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
Data
 
T
yp
e
s
 
In
 
Pyth
on
1.
N
um
ber
2.
Strin
g
3.
Boo
l
e
a
n
4.
List
5.
T
up
l
e
6.
S
et
7.
D
icti
o
n
ary
Visit School Website for Regular Updates
 
                                   
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
 
  
1.
Number
 
In
 
P
y
thon
It
 
i
s
 
use
d
 
t
o
 
s
t
o
r
e
 
nume
r
i
c
 
v
al
ues
P
y
thon
 
ha
s
 
th
r
ee
 
nume
r
i
c
 
ty
p
es:
1.
I
n
t
e
g
e
r
s
2.
F
l
o
a
t
i
n
g
 
po
i
n
t
 
n
u
mb
e
r
s
3.
Compl
e
x
 
nu
m
be
r
s.
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
1.
 
I
n
t
e
g
e
r
s
I
n
t
e
g
e
r
s
  
 
or
  
 
i
n
t
  
 
a
r
e
  
 
pos
it
i
v
e
  
 
or
  
 
ne
g
a
t
i
v
e
nu
m
be
r
s
 
with
 
n
o
 
de
c
i
m
al
 
po
i
n
t
.
 
I
n
t
e
g
e
r
s
 
i
n
 
P
y
t
h
o
n
3
 
a
r
e
 
of
 
un
l
i
m
i
t
ed
 
s
i
z
e
.
e
.
g.
a
=
 
100
b=
 
-
100
c=
 
1
*20
pr
i
n
t(
a
)
pr
i
n
t(
b
)
pr
i
n
t(
c
)
O
u
tput
 
:-
100
-
100
200
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
T
y
p
e
 
Co
n
v
e
r
s
i
o
n
 
o
f
 
I
n
t
e
g
er
i
n
t()
 
fu
n
cti
o
n
 
c
o
n
v
erts
 
a
n
y
 
d
a
t
a
 
type
 
t
o
 
i
n
t
e
g
e
r
.
e
.
g.
a
 
=
 
"
101
"
 
#
 
s
tr
ing
b
=
i
n
t(a)
 
#
 
c
o
n
v
erts
 
s
tr
i
n
g
 
d
a
t
a
 
type
 
t
o
 
i
nt
e
g
e
r
.
c
=
i
n
t
(122.
4)
 
#
 
c
o
n
v
erts
 
f
l
o
a
t
 
d
a
t
a
 
ty
p
e
 
t
o
 
i
n
t
e
g
e
r
.
pr
i
n
t(b)
p
r
i
n
t(c
)
Run
 
Code
Out
p
u
t
 
:-
101
122
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
2
.
 
F
l
o
a
ti
n
g
 
poi
n
t
 
num
b
e
r
s
It
 
i
s
 
a
 
p
o
s
iti
v
e
 
or
 
ne
g
a
ti
v
e
 
r
eal
 
nu
m
be
r
s
 
with
a
 
dec
i
mal
 
poi
n
t
.
e
.
g.
a
 
=
 
101
.2
b
 
=
 
-
101
.4
c
 
=
 
111
.
2
3
d
 
=
 
2
.
3
*3
pr
i
n
t
(a)
pr
i
n
t
(b)
pr
i
n
t(
c
)
pr
i
n
t
(d)
Run
 
Code
Outp
ut
 
:-
101
.2
-
101
.4
111
.
2
3
6
.
899999
9
9
999
9
99
9
5
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
T
ype
 
Co
n
v
e
r
s
i
o
n
 
o
f
 
F
l
o
a
ti
n
g
 
p
o
i
n
t
 
numbe
r
s
f
l
o
a
t
(
)
 
funct
i
o
n
 
c
o
n
v
e
r
ts
 
a
n
y
 
d
a
t
a
 
ty
p
e
 
t
o
 
f
l
o
a
ti
n
g
 
po
i
n
t
numb
e
r
.
e
.
g.
a
=
'
3
01
.
4
'
 
#
s
tr
i
ng
b=f
l
o
a
t(a)
 
#
c
o
n
v
erts
 
s
tr
i
n
g
 
d
at
a
 
t
y
p
e
 
t
o
 
f
l
o
a
ti
n
g
 
po
i
n
t
 
n
u
mbe
r
.
c=fl
o
a
t(
1
2
1
)
 
#
c
o
n
v
erts
 
i
nt
e
g
er
 
d
a
t
a
 
t
y
p
e
 
t
o
 
f
l
o
a
ti
n
g
 
po
i
n
t
 
n
u
mbe
r
.
pr
i
n
t(
b
)
pr
i
n
t(
c
)
R
u
n
 
Code
O
u
tput
 
:-
3
0
1.4
1
2
1.0
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
3.
 
Compl
e
x
 
nu
m
be
r
s
Comp
l
e
x
 
 
nu
m
be
r
s
 
 
a
r
e
 
 
c
omb
i
n
a
ti
o
n
 
 
of
 
 
a
 
 
r
eal
and
 
i
m
agi
na
r
y
 
part
.
Compl
e
x
 
nu
m
be
r
s
 
a
r
e
 
i
n
 
t
h
e
 
f
o
rm
of
 
X+
Y
j,
 
whe
r
e
 
X
 
i
s
 
a
 
r
eal
 
par
t
 
and
 
Y
 
i
s
 
i
m
agi
na
r
y
 
part
.
e
.
g
.
a
 
=
 
c
ompl
e
x(5
)
 
#
 
c
o
n
v
ert
 
5
 
t
o
 
a
 
r
eal
 
par
t
 
v
al
 
and
 
z
e
r
o
 
i
ma
gina
r
y
 
p
a
rt
pr
i
n
t(a)
b=co
m
p
l
e
x(1
0
1
,
23)
 
#
c
o
n
v
ert
 
101
 
w
i
th
 
r
eal
 
par
t
 
and
 
23
 
as
 
i
ma
gina
r
y
 
part
pr
i
n
t(
b
)
O
u
tput
 
:-
(
5
+0
j
)
(1
0
1+2
3
j)
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
2.
 
Strin
g
 
In
 
P
y
thon
A
 
s
tr
i
n
g
 
i
s
 
a
 
s
e
quen
c
e
 
o
f
 
c
h
a
r
a
c
t
e
r
s
.
 
I
n
 
p
y
t
h
o
n
 
w
e
 
c
an
 
c
r
e
a
t
e
 
s
t
r
i
n
g
 
us
i
n
g
s
i
n
g
le
 
('
 
')
 
o
r
 
do
u
b
le
 
q
u
o
t
es
 
("
 
")
.
Both
 
a
r
e
 
sa
m
e
 
i
n
 
p
y
tho
n
.
 
e
.
g.
s
t
r
='
c
omp
u
t
er
 
sc
ien
c
e'
pri
n
t
('
s
t
r
-
'
,
 
s
t
r
)
 
#
 
pri
nt
 
s
t
r
ing
pri
n
t
('
s
t
r
[0]
-
'
,
 
s
t
r
[
0
])
 
#
 
pri
nt
 
fi
r
s
t
 
c
ha
r
 
'h'
pri
n
t
('
s
t
r
[1
:3
]
-
'
,
  
s
t
r
[
1:3
])
 
#
 
pri
nt
 
s
t
r
in
g
 
f
r
o
m
 
po
s
ti
o
n
 
1
 
t
o
 
3
 
'ell
'
pri
n
t
('
s
t
r
[3:]
-
'
,
 
 
s
t
r
[
3:
])
 
#
 
pri
nt
 
s
t
r
in
g
 
s
t
ar
i
n
g
 
f
r
o
m
 
3
r
d
 
c
ha
r
 
'
ll
o
 
w
or
l
d'
pri
n
t
('
s
tr
 
*
2
-
'
,
 
s
tr
 
*
2
 
)
 
#
 
pri
nt
 
s
t
r
in
g
 
t
w
o
 
ti
mes
Visit School Website for Regular Updates
pri
n
t
(
"
s
tr
 
+
'
y
e
s
'-
",
Ou
t
put
s
t
r
-
 
c
ompu
t
er
 
sc
ience
s
t
r
[
0
]-
 
c
s
t
r
[
1
:
3
]-
 
om
s
t
r
[
3
:
]-
 
pute
r
 
sc
ience
s
tr
 
+'
y
e
s')
 
#
 
c
on
ca
t
en
a
t
ed
 
s
t
r
ing
s
tr
 
*2
-
 
c
ompu
t
er
 
sc
ienc
e
c
ompu
t
er
 
sc
ience
s
tr
 
+
'
y
es
'
-
 
c
ompu
t
er
 
sc
ienc
e
y
es
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
I
t
e
r
a
ti
n
g
 
th
r
oug
h
 
s
tr
ing
e
.
g.
s
t
r
='
com
p
 
s
c'
f
o
r
 
i
 
in
 
s
t
r
:
pr
i
n
t
(
i
)
O
u
tput
c
o
m
p
s
c
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
3
.
 
Boolean
 
I
n
 
P
y
thon
It
 
i
s
 
use
d
 
t
o
 
s
t
o
r
e
 
t
w
o
 
poss
i
b
le
 
v
al
ue
s
 
e
i
t
h
er
 
true
 
or
f
al
se
e
.
g
.
s
t
r="
c
om
p
 
s
c
"
boo
=
s
t
r
.i
s
u
ppe
r()
 
#
 
t
e
s
t
 
if
 
s
tr
in
g
 
c
o
n
t
ai
n
s
 
up
p
er
 
c
ase
pr
i
n
t(boo)
Out
p
ut
F
al
se
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
4.
L
i
s
t
 
In
 
P
y
thon
Li
s
t
 
a
r
e
 
c
o
l
l
ect
ion
s
 
o
f
 
i
t
e
m
s
 
and
 
each
 
i
t
em
 
ha
s
 
its
 
o
wn
 
i
nd
e
x
 
v
al
ue.
5.
T
up
l
e
 
In
 
P
y
thon
Li
s
t
 
and
 
tu
p
l
e,
 
b
ot
h
 
a
r
e
 
s
a
me
 
e
x
c
e
p
t
 
,
a
 
li
s
t
 
i
s
 
mu
t
abl
e
 
p
ython
 
o
bj
e
c
ts
 
and
 
tu
p
l
e
 
i
s
i
mmu
t
able
 
P
y
thon
 
object
s.
 
Im
m
u
t
able
 
P
y
thon
 
o
bject
s
 
mean
 
y
o
u
 
c
annot
 
mod
i
f
y
 
t
he
c
o
n
t
e
n
ts
 
o
f
 
a
 
tup
l
e
 
onc
e
 
i
t
 
i
s
 
a
s
s
ig
n
e
d
.
Visit School Website for Regular Updates
e
.
g.
 
o
f
 
l
i
s
t
li
s
t
 
=[
6,9
]
li
s
t
[0
]=
55
pr
i
n
t
(
li
s
t
[0])
pri
n
t
(
li
s
t
[1
])
O
U
T
P
UT
55
9
e
.
g.
 
o
f
 
tup
l
e
tup
=(66
,
9
9
)
T
u
p
[0]=3
 
#
 
er
r
o
r
 
me
ss
a
g
e
 
w
i
l
l
 
b
e
 
d
i
s
p
l
ay
ed
pr
i
n
t
(
tu
p[0])
pri
n
t
(
tup
[1])
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
6.
 
S
e
t
 
In
 
P
y
thon
It
 
i
s
 
an
 
uno
r
de
r
ed
 
c
o
ll
e
cti
o
n
 
o
f
 
uniqu
e
 
and
i
m
mu
t
able
 
(w
hi
ch
 
c
annot
 
b
e
 
mod
i
fie
d
)
i
t
em
s.
e
.
g.
s
e
t1=
{
1
1
,22
,
3
3,2
2
}
pr
i
n
t(s
e
t1)
Out
p
ut
{33
,
 
11,
 
22}
Visit School Website for Regular Updates
D
a
t
a
 
t
ype
 
c
o
n
ti
nue
7.
 
D
i
cti
o
n
a
r
y
 
In
 
P
y
thon
It
 
i
s
 
an
 
uno
r
de
r
ed
 
c
o
ll
ect
io
n
 
o
f
 
i
t
ems
 
and
 
each
 
i
t
em
c
onsi
s
t
 
o
f
 
a
 
k
e
y
 
and
 
a
 
v
al
u
e
.
e
.
g.
d
ict
 
=
 
{
'
S
u
bje
c
t':
 
'
c
om
p
 
s
c',
 
'cla
s
s'
:
 
'11'}
pr
i
n
t
(
d
ict)
pr
i
n
t
 
(
"Su
bje
c
t
 
:
 
",
 
d
ic
t
['Sub
ject'])
pr
i
n
t
 
(
"class
 
:
 
",
 
d
ict
.
g
e
t
('
c
la
s
s'))
Ou
tp
u
t
{'S
u
bject'
:
 
'
c
om
p
 
s
c',
 
'class
'
:
 
'1
1
'}
Subjec
t
 
:
 
c
om
p
 
sc
class
 
:
 
11
Visit School Website for Regular Updates
Ope
r
a
t
or
Ope
r
a
t
o
r
s
 
a
r
e
 
s
p
e
c
i
al
 
s
ymbo
l
s
 
in
 
P
ython
 
th
a
t
 
c
arry
 
ou
t
 
ar
ithm
e
t
ic
 
o
r
 
log
i
c
al
c
ompu
t
a
t
i
on
.
 
Th
e
 
v
a
lu
e
 
th
a
t
 
t
h
e
 
op
e
r
a
t
o
r
 
ope
r
a
t
es
 
o
n
 
i
s
 
c
a
l
l
ed
 
the
 
ope
r
an
d
.
Arithm
e
tic
 
ope
r
at
o
r
s
U
s
ed
 
f
o
r
 
m
a
them
a
ti
c
al
 
o
p
e
r
a
ti
on
Visit School Website for Regular Updates
O
p
e
r
a
t
o
r
 
c
o
n
ti
nue
Ar
i
thm
a
t
ic
 
op
e
r
a
t
o
r
 
c
o
n
t
i
n
u
e
e
.
g.
x
 
=
 
5
y
 
=
 
4
pri
n
t
('x
 
+
 
y
 
='
,
x+
y
)
pri
n
t
('x
 
-
 
y
 
=
'
,
x-
y)
pri
n
t
('x
 
*
 
y
 
=',x*y)
pri
n
t
('x
 
/
 
y
 
=
'
,
x/y)
pri
n
t
('x
 
/
/
 
y
 
=',x//y)
pri
n
t
('x
 
**
 
y
 
=
'
,
x*
*
y)
O
U
T
P
UT
('
x
 
+
 
y
 
='
,
 
9)
('
x
 
-
 
y
 
='
,
 
1)
('
x
 
*
 
y
 
='
,
 
20)
('
x
 
/
 
y
 
='
,
 
1)
(
'x
 
/
/
 
y
 
=',
 
1)
('
x
 
**
 
y
 
='
,
 
62
5
)
Visit School Website for Regular Updates
W
r
i
t
e
 
a
 
p
r
og
r
am
 
in
 
p
ython
 
t
o
 
c
al
c
u
l
a
t
e
 
the
 
s
i
mpl
e
i
n
t
e
r
e
s
t
 
ba
s
ed
 
o
n
 
e
n
t
e
r
ed
 
amou
nt
 
,
r
a
t
e
 
and
 
t
i
me
O
p
e
r
a
t
o
r
 
c
o
n
ti
nue
Ar
i
thm
a
t
i
c
 
ope
r
a
t
o
r
 
c
o
n
t
i
nue
#
 
EM
I
 
Cal
c
u
l
a
t
o
r
 
p
r
o
g
r
am
 
i
n
 
P
ython
de
f
 
emi_
c
al
c
u
l
a
t
o
r
(p
,
 
r
,
 
t
)
:
r
 
=
 
r
 
/
 
(
1
2
 
*
 
100)
 
#
 
on
e
 
mo
n
th
 
i
n
t
e
r
e
s
t
t
 
=
 
t
 
*
 
12
 
#
 
on
e
 
mo
n
th
 
p
e
r
i
od
emi
 
=
 
(
p
 
*
 
r
 
*
 
p
o
w
(1
 
+
 
r
,
 
t
)
)
 
/
 
(p
o
w
(1
 
+
 
r
,
 
t)
 
-
 
1)
r
e
turn
 
emi
#
 
dr
i
v
er
 
c
ode
princ
i
pa
l
 
=
 
10000;
r
a
t
e
 
=
 
10;
t
i
me
 
=
 
2;
emi
 
=
 
emi_
c
al
c
u
l
a
t
or
(p
r
inc
i
pa
l
,
 
r
a
t
e,
 
t
ime);
pri
n
t
(
"M
on
th
ly
 
E
M
I
 
i
s
=
 
",
 
em
i
)
Visit School Website for Regular Updates
O
p
e
r
a
t
o
r
 
c
o
n
ti
nue
Ar
i
th
m
a
t
i
c
 
ope
r
a
t
o
r
 
c
o
n
t
i
nue
H
ow
 
t
o
 
c
al
c
u
l
a
t
e
 
G
S
T
G
S
T
 
(
 
Goods
 
and
 
Se
rvi
c
es
 
T
a
x
 
)
 
wh
i
c
h
 
i
s
 
inc
l
u
d
ed
 
i
n
 
ne
tpr
i
c
e
 
of
p
r
oduc
t
 
f
o
r
 
ge
t
 
G
S
T
 
%
 
f
i
r
s
t
 
ne
e
d
 
t
o
 
c
a
l
c
u
l
a
t
e
 
G
S
T
 
Amou
n
t
 
b
y
 
sub
t
r
a
c
t
 
o
r
i
gi
nal
c
o
s
t
 
f
r
o
m
 
N
e
tpr
i
c
e
 
and
 
then
 
ap
p
l
y
G
S
T
 
%
 
f
ormul
a
 
=
 
(
G
S
T_A
m
ou
nt
*100
)
 
/
 
or
i
gi
na
l
_
c
o
s
t
#
 
P
y
thon3
 
P
r
og
r
am
 
t
o
 
c
o
mpu
t
e
 
G
S
T
 
f
r
o
m
 
or
i
gi
nal
 
and
 
ne
t
 
pri
c
e
s
.
de
f
 
C
a
l
c
u
l
a
t
e
_
G
S
T(
o
r
g
_
c
o
s
t,
 
N_p
r
i
c
e
):
#
 
r
e
turn
 
v
al
u
e
 
a
f
t
er
 
c
al
c
u
l
a
t
e
 
G
S
T%
r
e
turn
 
(
(
(
N_p
r
i
c
e
 
-
 
o
r
g
_
c
o
s
t
)
 
*
 
100)
 
/
 
o
r
g
_
c
o
s
t
);
#
 
Dr
i
v
er
 
p
r
og
r
am
 
t
o
 
t
e
s
t
 
ab
o
v
e
 
f
u
n
c
t
i
ons
o
r
g
_
c
o
s
t
 
=
 
100
N_pri
c
e
 
=
 
120
pri
n
t
(
"G
S
T
 
=
 
"
,
en
d
=
'')
pr
i
n
t
(
r
ound(Ca
lc
u
l
a
t
e_G
S
T
(
o
r
g_
c
o
s
t,
 
N_pr
ic
e
))
,
end='')
pri
n
t
("%
"
)
*
 
W
r
i
t
e
 
a
 
P
ython
 
p
r
og
r
am
 
t
o
 
c
al
c
u
l
a
t
e
 
the
 
s
t
and
a
r
d
 
de
vi
a
t
i
on
Visit School Website for Regular Updates
Ope
r
a
t
o
r
 
c
o
n
ti
nue
Compar
i
so
n
 
ope
r
a
t
o
r
s
 
-
u
s
ed
 
t
o
 
c
omp
a
r
e
 
v
al
ues
Visit School Website for Regular Updates
Ope
r
a
t
o
r
 
c
o
n
ti
nue
Compar
i
s
o
n
 
o
p
e
r
at
o
r
s
 
c
o
n
ti
nue
e
.
g.
x
 
=
 
10
1
y
 
=
 
1
2
1
pr
i
n
t
(
'
x
 
>
 
y
 
 
i
s
'
,
x>
y
)
pr
i
n
t
(
'
x
 
<
 
y
 
 
i
s
'
,
x<
y
)
pr
i
n
t(
'
x
 
==
 
y
 
i
s',x=
=
y)
pr
i
n
t
(
'
x
 
!=
 
y
 
i
s
'
,
x!
=
y)
pr
i
n
t
(
'
x
 
>=
 
y
 
i
s
'
,
x>
=
y)
pr
i
n
t
(
'
x
 
<=
 
y
 
i
s
'
,
x<
=
y)
Ou
t
put
(
'
x
 
>
 
y
 
 
i
s'
,
 
F
a
l
se
)
(
'
x
 
<
 
y
 
 
i
s
',
 
T
rue)
(
'
x
 
==
 
y
 
i
s
',
 
F
a
l
se)
(
'
x
 
!
=
 
y
 
i
s
',
 
T
rue)
(
'
x
 
>=
 
y
 
i
s
',
 
F
a
l
se)
(
'
x
 
<=
 
y
 
i
s
',
 
T
rue)
Visit School Website for Regular Updates
O
p
e
r
a
t
o
r
 
c
o
n
ti
nue
Log
i
c
al
 
ope
r
at
o
r
s
Visit School Website for Regular Updates
e
.
g.
x
 
=
 
T
rue
y
 
=
 
F
a
l
se
pr
i
n
t('x
 
and
 
y
 
i
s',x
 
and
 
y)
pr
i
n
t(
'
x
 
o
r
 
y
 
i
s'
,
x
 
o
r
 
y)
pr
i
n
t(
'no
t
 
x
 
i
s'
,no
t
 
x)
Ou
t
pur
(
'
x
 
and
 
y
 
i
s'
,
 
F
a
l
se)
(
'
x
 
o
r
 
y
 
i
s'
,
 
T
rue)
(
'no
t
 
x
 
i
s'
,
 
F
a
l
se
)
Ope
r
a
t
o
r
 
c
o
n
ti
nue
Bi
t
wi
s
e
 
ope
r
a
t
o
r
s
Used
 
t
o
 
man
ip
u
l
a
t
e
 
b
i
t
 
v
al
ue
s
.
Visit School Website for Regular Updates
O
p
e
r
a
t
o
r
 
c
o
n
ti
nue
Bitwi
s
e
 
ope
r
at
o
r
s
 
c
o
n
ti
n
ue
a
 
=
 
6
b
 
=
 
3
pr
i
n
t
 
(
'
a=',
a,':'
,b
i
n
(a),
'b
=
'
,b,'
:',b
i
n
(b)
)
c
 
=
 
0
c
 
=
 
a
 
&
 
b;
pr
i
n
t
 
(
"
r
esult
 
o
f
 
AND
 
is
 
",
 
c
,
':
',bi
n
(c))
c
 
=
 
a
 
|
 
b;
pr
i
n
t
 
(
"
r
esult
 
o
f
 
O
R
 
is
 
",
 
c
,
':
',bi
n
(c))
c
 
=
 
a
 
^
 
b;
pr
i
n
t
 
(
"
r
esult
 
o
f
 
E
X
O
R
 
is
 
",
 
c
,
':
',bi
n
(c))
c
 
=
 
~a;
pr
i
n
t
 
(
"
r
esult
 
o
f
 
C
OM
P
LE
M
EN
T
 
is
 
",
 
c
,
':
',bi
n
(c))
c
 
=
 
a
 
<<
 
2
;
pr
i
n
t
 
(
"
r
esult
 
o
f
 
LEF
T
 
SH
I
F
T
 
i
s
 
",
 
c
,
':
',bi
n
(c))
c
 
=
 
a
 
>
>
 
2
;
pr
i
n
t
 
(
"
r
esult
 
o
f
 
RIGHT
 
SH
I
F
T
 
is
 
",
 
c
,
':
',bi
n
(c))
Visit School Website for Regular Updates
Output
('
a=',
 
6,
 
':
'
,
 
'0b110',
 
'b=',
 
3,
 
':
'
,
 
'0b11')
('
r
e
su
l
t
 
o
f
 
A
N
D
 
i
s
 
',
 
2,
 
':
'
,
 
'0b10')
('
r
e
su
l
t
 
o
f
 
O
R
 
is
 
',
 
7,
 
':
'
,
 
'0b111')
('
r
e
su
l
t
 
o
f
 
E
X
O
R
 
is
 
',
 
5,
 
':
'
,
 
'0b101')
('
r
e
su
l
t
 
o
f
 
C
O
M
P
LE
M
EN
T
 
i
s
 
',
 
-
7,
 
':
'
,
 
'-
0b111')
('
r
e
su
l
t
 
o
f
 
LEF
T
 
SHIF
T
 
is
 
',
 
24,
 
':
'
,
 
'0b11000')
('
r
e
su
l
t
 
o
f
 
RIGHT
 
SHIF
T
 
is
 
',
 
1,
 
':
'
,
 
'0b1')
O
p
e
r
a
t
o
r
 
c
o
n
ti
nue
Python
 
Membershi
p
 
Ope
r
ators
T
e
s
t
 
for
 
mem
b
er
sh
i
p
 
i
n
 
a
 
s
e
q
uen
c
e
Visit School Website for Regular Updates
e
.
g.
a
 
=
 
5
b
 
=
 
1
0
li
st
 
=
 
[
1,
 
2,
 
3,
 
4,
 
5
 
]
i
f
 
(
 
a
 
in
 
li
st
 
):
print
 
("
L
i
ne
 
1
 
-
 
a
 
is
 
a
v
ai
l
able
 
in
 
t
he
 
gi
v
en
 
li
s
t
")
e
l
s
e
:
print
 
("
L
i
ne
 
1
 
-
 
a
 
is
 
not
 
a
v
ai
l
able
 
in
 
t
he
 
gi
v
en
 
li
s
t
")
i
f
 
(
 
b
 
not
 
in
 
li
st
 
):
print
 
("
L
i
ne
 
2
 
-
 
b
 
i
s
 
not
 
a
v
ai
l
able
 
in
 
t
he
 
gi
v
en
 
li
s
t
")
e
l
s
e
:
print
 
("
L
i
ne
 
2
 
-
 
b
 
i
s
 
a
v
ai
l
able
 
in
 
t
he
 
gi
v
en
 
li
s
t")
out
pu
t
L
i
n
e
 
1
 
-
 
a
 
is
 
a
v
ailable
 
in
 
t
h
e
 
gi
v
en
 
li
s
t
L
i
n
e
 
2
 
-
 
b
 
is
 
n
o
t
 
av
ailable
 
in
 
t
h
e
 
gi
v
en
 
li
s
t
O
p
e
r
a
t
o
r
 
c
o
n
ti
nue
Python
 
Ident
i
t
y
 
Ope
r
ato
r
s
Visit School Website for Regular Updates
e.
g
.
a
 
=
 
10
b
 
=
 
10
p
r
i
nt
 
(
'L
i
ne
 
1
',
'
a=
'
,
a,'
:
',
i
d(a)
,
 
'
b
='
,
b
,':
'
,
i
d(
b
))
i
f
 
(
 
a
 
i
s
 
b
 
):
p
r
i
nt
 
("L
i
ne
 
2
 
-
 
a
 
and
 
b
 
h
a
v
e
 
same
 
i
d
en
t
i
t
y")
el
s
e
:
p
r
i
nt
 
("L
i
ne
 
2
 
-
 
a
 
and
 
b
 
d
o
 
not
 
h
a
v
e
 
same
 
i
d
en
t
i
t
y")
OUT
P
UT
('
L
i
ne
 
1'
,
 
'
a='
,
 
10
,
 
':
'
,
 
2
0
8
3
94
36,
 
 
'
b
='
,
 
10
,
 
':
'
,
 
2
0
8
3
94
36)
L
i
ne
 
2
 
-
 
a
 
and
 
b
 
h
a
v
e
 
same
 
i
d
en
t
i
ty
Ope
r
a
t
o
r
 
c
o
n
ti
nue
O
p
e
r
ators
 
Pre
c
e
d
en
c
e
 
 
:
h
i
gh
e
s
t
 
p
r
eced
e
nc
e
 
t
o
 
l
o
w
e
s
t
 
p
r
eced
e
nc
e
 
t
abl
e
Visit School Website for Regular Updates
Exp
r
es
s
i
on
It
 
i
s
 
a
 
v
ali
d
 
c
omb
in
a
ti
o
n
 
o
f
 
ope
r
at
o
r
s,
l
i
t
e
r
als
 
and
v
ariab
l
e.
1.
Ar
ithm
a
tic
 
e
xp
r
ess
io
n
 
:
-
 
e
.
g.
 
c
=
a+b
2.
R
e
l
a
t
i
ona
l
 
e
xp
r
ess
i
o
n
 
:-
 
e
.
g.
 
x
>y
3.
Log
i
c
al
 
e
xp
r
ess
i
o
n
 
:
-
 
a
 
o
r
 
b
4.
Strin
g
 
e
xp
r
ess
i
o
n
 
:
-
 
c=
c
omp”+
s
c
Visit School Website for Regular Updates
T
ype
 
c
o
n
v
e
r
s
i
on
Th
e
 
p
r
o
ce
s
s
 
o
f
 
c
o
n
v
ert
i
n
g
 
the
 
v
al
u
e
 
o
f
 
on
e
 
d
a
t
a
 
type
 
(
in
t
ege
r
,
 
s
t
r
in
g
,
 
f
l
o
a
t,
 
e
t
c
.
)
 
t
o
 
an
other
d
a
t
a
 
type
 
is
 
c
a
l
l
ed
 
type
 
c
o
n
v
e
r
s
i
on.
P
y
thon
 
has
 
t
w
o
 
types
 
o
f
 
type
 
c
o
n
v
e
r
s
i
on.
Im
p
li
c
i
t
 
T
ype
 
Co
n
v
e
r
s
i
on
Exp
l
i
c
i
t
 
T
ype
 
Co
n
v
e
r
s
i
on
Impl
ici
t
 
T
ype
 
Co
n
v
e
r
s
i
on:
In
 
Im
p
li
c
i
t
 
type
 
c
o
n
v
e
r
s
i
on
,
 
P
y
t
h
o
n
 
au
t
om
a
t
i
c
all
y
 
c
o
n
v
erts
 
on
e
 
d
a
t
a
 
type
 
t
o
 
a
n
othe
r
 
d
a
t
a
type
.
 
Th
is
 
p
r
o
ce
s
s
 
do
e
s
n
't
 
need
 
a
n
y
 
u
s
er
 
i
n
v
o
l
v
em
e
nt
.
e
.
g
.
num_
i
n
t
 
=
 
12
num_f
l
o
 
=
 
10
.
23
Visit School Website for Regular Updates
num
_
n
e
w
 
=
 
num
_
i
n
t
 
+
 
num
_
f
l
o
 
pr
i
n
t(
"
d
a
t
a
type
 
o
f
 
num_
i
n
t:
"
,
type
(num_
i
n
t
))
pr
i
n
t(
"
d
a
t
a
type
 
o
f
 
num_
fl
o
:
"
,
type
(num_f
l
o))
pr
i
n
t(
"
V
a
l
u
e
 
o
f
 
num_n
e
w
:
",num_n
e
w)
pr
i
n
t(
"
d
a
t
a
type
 
o
f
 
num_n
e
w
:
"
,
typ
e(num_new
))
O
UT
P
UT
(
'
d
ata
ty
p
e
 
of
 
num
_i
n
t:
',
 
<
t
y
p
e
 
'
i
n
t
'>)
(
'
d
ata
ty
p
e
 
of
 
num
_fl
o
:
',
 
<
t
y
p
e
 
'flo
a
t'>)
(
'
V
al
u
e
 
o
f
 
nu
m
_n
e
w
:
',
 
2
2
.2
3
)
(
'
d
ata
ty
p
e
 
of
 
num
_
n
e
w
:
',
 
<
t
y
p
e
 
'flo
a
t'>)
T
ype
 
c
o
n
v
e
r
s
i
on
E
x
p
l
ic
it
 
T
ype
 
Co
n
versio
n
:
In
 
Exp
lici
t
 
T
ype
 
Co
n
v
e
r
s
i
on
,
 
us
e
r
s
 
c
o
n
v
ert
 
the
 
d
a
t
a
 
type
 
o
f
 
an
 
obj
e
c
t
 
t
o
 
r
equ
i
r
ed
d
a
t
a
 
typ
e
.
 
W
e
 
u
s
e
 
the
 
p
r
ed
e
f
i
ne
d
 
f
u
nction
s
 
li
k
e
 
i
n
t
(
)
,
f
l
o
a
t
(
),
s
t
r
(
)
 
e
t
c
.
e
.
g.
num_
i
n
t
 
=
 
12
num_
str
 
=
 
"45"
print("Dat
a
 
t
y
p
e
 
o
f
 
num
_
i
n
t:",t
y
pe(num_
i
n
t))
pr
i
nt(
"
Dat
a
 
t
y
p
e
 
o
f
 
num_st
r
 
befo
r
e
 
T
y
p
e
 
Cast
i
ng:"
,t
y
pe(num_str
))
num_
str
 
=
 
i
n
t
(num_
st
r
)
print("Dat
a
 
t
y
p
e
 
o
f
 
num_
str
 
afte
r
 
T
y
p
e
 
Ca
sti
ng:",t
y
p
e
(num_
str))
num_
s
um
 
=
 
num_
i
n
t
 
+
 
num_
str
print("Sum
 
o
f
 
num_
i
n
t
 
an
d
 
nu
m_st
r
:",num_
s
u
m)
print("Dat
a
 
t
y
p
e
 
o
f
 
the
 
s
um:",t
y
p
e
(num_
s
u
m))
O
UT
PUT
(
'Dat
a
 
t
y
p
e
 
o
f
 
num_
i
n
t
:',
 
<t
y
p
e
 
'
i
n
t
'>)
(
'Dat
a
 
t
y
p
e
 
o
f
 
num_
str
 
befor
e
 
T
y
p
e
 
Ca
sti
ng:'
,
 
<t
y
p
e
 
'
str'>)
(
'Dat
a
 
t
y
p
e
 
o
f
 
num_
str
 
afte
r
 
T
y
p
e
 
Ca
sti
ng:'
,
 
<t
y
p
e
 
'i
n
t
'>)
(
'Sum
 
o
f
 
num_
i
n
t
 
and
 
num_
st
r
:',
 
57)
(
'Dat
a
 
t
y
p
e
 
o
f
 
the
 
s
um:'
,
 
<t
y
p
e
 
'
i
n
t
'>)
Visit School Website for Regular Updates
 
                                              
m
a
th
 
modul
e
I
t
 
i
s
 
a
 
s
t
anda
r
d
 
mo
d
u
le
 
i
n
 
P
y
tho
n
.
 
T
o
 
us
e
 
m
a
the
m
a
t
i
c
al
 
fu
ncti
on
s
 
o
f
 
t
h
is
 
modu
l
e,
w
e
h
a
v
e
 
t
o
 
i
m
por
t
 
the
 
modu
l
e
 
u
s
i
ng
 
i
m
por
t
 
m
a
t
h
.
Visit School Website for Regular Updates
Co
n
t
r
o
l
 
S
t
a
t
eme
n
ts
Co
n
t
r
o
l
 
 
s
ta
t
em
e
n
ts
 
 
a
r
e
 
 
use
d
 
 
t
o
 
 
c
o
n
t
r
o
l
 
 
the
 
 
f
l
ow
 
 
of
e
x
e
c
ut
i
o
n
 
d
e
p
e
nd
in
g
 
upo
n
 
the
 
spec
i
f
i
ed
 
c
ond
iti
o
n/
l
o
gi
c
.
The
r
e
 
a
r
e
 
th
r
ee
 
typ
e
s
 
o
f
 
c
o
n
t
r
o
l
 
s
t
a
t
em
e
n
t
s
.
1.
Dec
i
s
i
o
n
 
Maki
n
g
 
S
ta
t
em
e
n
ts
2.
I
t
e
r
a
ti
o
n
 
S
ta
t
em
e
n
ts
 
(Loo
p
s)
3.
Jump
 
S
ta
t
em
e
n
ts
 
(b
r
eak,
 
c
o
n
ti
nue
,
 
pas
s)
Visit School Website for Regular Updates
Dec
i
s
i
o
n
 
M
aki
n
g
 
S
t
a
t
eme
n
t
De
c
i
s
i
o
n
 
m
a
ki
n
g
 
s
tat
eme
n
t
 
use
d
 
t
o
 
c
o
n
t
r
o
l
 
the
 
f
l
ow
o
f
 
e
x
e
c
ut
i
o
n
 
o
f
 
p
r
o
g
r
am
 
d
e
p
e
nd
in
g
 
upo
n
 
c
ond
iti
o
n.
The
r
e
 
a
r
e
 
th
r
ee
 
typ
e
s
 
o
f
 
d
e
c
i
s
i
o
n
 
maki
n
g
 
s
t
a
t
em
e
n
t
.
1.
if
 
s
t
a
t
em
e
n
ts
2.
if
-
el
se
 
s
t
a
t
em
e
n
ts
3.
Ne
st
ed
 
i
f-
el
se
 
s
t
a
t
e
m
e
n
t
Visit School Website for Regular Updates
Dec
i
s
i
o
n
 
Maki
n
g
 
S
t
a
t
eme
n
t
1
.
 
if
 
s
t
a
t
em
e
n
ts
An
 
if
 
s
t
a
t
em
e
n
t
 
is
 
a
 
p
r
o
g
r
a
m
mi
ng
s
t
a
t
em
e
n
t
 
th
a
t,
 
if
 
p
r
o
v
ed
 
true,
 
p
er
f
orm
s
 
a
o
r
 
d
i
sp
l
a
y
s
 
i
n
f
orm
a
ti
o
n
.
c
ond
iti
o
nal
funct
i
on
Visit School Website for Regular Updates
Dec
i
s
i
o
n
 
Maki
n
g
 
S
t
a
t
eme
n
t
1
.
 
if
 
s
t
a
t
em
e
n
ts
S
y
n
ta
x
:
i
f(
c
ond
it
i
o
n):
s
tat
e
m
e
n
t
[
s
tat
e
m
e
n
ts]
e
.
g.
noof
b
oo
k
s
 
=
 
2
i
f
 
(
noofboo
k
s
 
==
 
2
)
:
pr
i
n
t
('
Y
o
u
 
h
a
v
e
 
')
pri
n
t(
t
w
o boo
k
s’)
pri
n
t(
outside of
 
if 
s
tat
e
m
e
n
t
’)
O
u
tput
Y
o
u
 
h
a
v
e
 
t
w
o
 
boo
k
s
No
t
e:
T
o
 
i
nd
i
c
at
e
 
a
 
b
l
oc
k
 
o
f
 
c
od
e
 
in
 
P
y
thon,
 
y
o
u
 
mu
s
t
 
i
n
de
n
t
 
each
 
l
in
e
 
of
the
 
b
l
oc
k
 
b
y
 
the
 
sa
m
e
 
amou
n
t.
 
In
 
ab
o
v
e
 
e
.
g.
 
bot
h
 
pr
i
n
t
 
stat
e
m
e
n
ts
 
a
r
e
par
t
 
o
f
 
i
f
 
cond
i
ti
o
n
 
becaus
e
 
o
f
 
bot
h
 
a
r
e
 
a
t
 
sam
e
 
l
e
v
el
 
i
nde
n
t
ed
 
b
u
t
 
not
the
 
thi
r
d
 
pr
i
n
t
 
s
tat
e
m
e
n
t.
Visit School Website for Regular Updates
Dec
i
s
i
o
n
 
Maki
n
g
 
S
t
a
t
eme
n
t
1
.
 
i
f
 
st
a
t
eme
n
ts
Us
i
n
g
 
l
o
g
i
c
al
 
ope
r
a
t
o
r
 
in
 
if
 
s
t
a
t
em
e
n
t
x
=1
y=2
if(x=
=
1
 
and
 
y==
2
)
:
pr
i
n
t
(
c
ondi
ti
on
 
m
a
t
ci
n
g
 
the
 
c
r
i
t
er
i
a')
Outpu
t
 
:
-
c
ond
it
i
o
n
 
m
a
t
c
in
g
 
the
 
c
r
i
t
er
i
a
----------
-
--
-
--
-
--
-
--
-
--
-
--
-
--
-
--
-
--
-
--
-
--
-
--
-
--
-
--
-
--
-
---
a
=
1
0
0
i
f
 
no
t
(a
 
==
 
20
):
p
r
in
t
(
'
a
 
is
 
n
o
t
 
eq
u
al
 
to
 
2
0
'
)
O
u
tput
 
:-
a is
 
n
o
t
 
eq
u
al
 
to
 
20
Visit School Website for Regular Updates
Dec
i
s
i
o
n
 
M
aki
n
g
 
S
t
a
t
eme
n
t
2.
 
i
f-el
s
e
 
S
t
at
eme
n
ts
I
f
-
e
ls
e
 
s
tat
e
m
e
n
t
 
e
x
ecu
t
es
 
so
m
e
 
c
od
e
 
if
 
the
 
t
e
s
t
 
e
xp
r
es
s
i
o
n
 
is
 
true
(
n
on
z
e
r
o
)
 
and
 
s
o
m
e
 
othe
r
 
c
od
e
 
if
 
the
 
t
e
s
t
 
e
xp
r
e
s
s
i
o
n
 
is
 
f
a
ls
e
.
Visit School Website for Regular Updates
Dec
i
s
i
o
n
 
M
aki
n
g
 
S
t
a
t
eme
n
t
2.
 
i
f
-el
s
e
 
S
t
a
t
eme
n
ts
S
y
nta
x
:
i
f
(
c
ondit
i
o
n
):
statements
else:
statements
e
.
g.
a=10
i
f(
a
 
<
 
100):
pr
i
n
t(
l
e
ss
 
than
 
1
0
0')
e
lse:
pr
i
n
t(‘
m
o
r
e
 
than 
e
qual
 
10
0
')
OUTP
U
T
l
es
s
 
than
 
100
*
W
r
i
t
e
 
a
 
p
r
og
r
am
 
in
 
p
y
thon
 
t
o
 
c
he
c
k
 
th
a
t
 
e
n
t
e
r
ed
 
n
u
m
e
r
 
is
 
e
v
en
 
o
r
 
odd
Visit School Website for Regular Updates
Dec
i
s
i
o
n
 
M
aki
n
g
 
S
t
a
t
eme
n
t
3.
 
N
e
s
t
ed
 
i
f
-e
ls
e
 
s
t
at
eme
n
t
The
 
ne
s
ted
 
if
.
.
.
el
se
 
statement
 
allo
ws
 
you
 
to
 
c
h
e
c
k
 
for
 
mult
i
pl
e
 
t
e
s
t
expre
s
sio
n
s
 
an
d
 
execut
e
 
di
f
ferent
 
c
o
de
s
 
for
 
more
 
than
 
two
c
o
ndition
s
.
Visit School Website for Regular Updates
Dec
i
s
i
o
n
 
Maki
n
g
 
S
t
a
t
eme
n
t
3.
 
Ne
s
t
ed
 
i
f-el
s
e
 
s
t
at
eme
n
t
S
y
n
t
a
x
If
 
(
c
ond
it
i
on):
s
t
a
t
em
e
n
ts
el
i
f
 
(
c
ond
it
i
on):
s
t
a
t
eme
n
ts
el
s
e:
s
t
a
t
em
e
n
ts
E
.
G.
num
 
=
 
fl
o
a
t(
i
n
p
u
t
(
"
E
nt
er
 
a
 
number
:
 
"
)
)
i
f
 
num
 
>=
 
0
:
i
f
 
num
 
==
 
0
:
pr
i
n
t(
"
Z
e
r
o"
)
el
se:
pr
i
n
t(
"
P
os
iti
v
e
 
numbe
r
")
el
se:
pr
i
n
t(
"
Ne
g
a
ti
v
e
 
numbe
r
")
OUT
P
UT
E
nt
er
 
a
 
n
umber
:
 
5
P
os
iti
v
e
 
number
*
 
W
r
i
t
e
 
p
y
t
ho
n
 
p
r
og
r
am
 
t
o
 
f
i
n
d
 
ou
t
 
la
r
g
e
s
t
 
o
f
 
3
 
numbe
r
s.
Visit School Website for Regular Updates
I
t
e
r
a
ti
o
n
 
S
t
a
t
eme
n
ts
 
(Loop
s
)
I
t
e
r
a
ti
o
n
 
s
tat
em
e
n
t
s
(
l
oop
)
 
a
r
e
 
use
d
 
t
o
 
ex
e
c
u
t
e
 
a
 
b
l
o
ck
 
of
s
t
a
t
e
m
e
n
ts
 
as
 
l
on
g
 
as
 
the
 
c
ond
iti
o
n
 
is
 
true
.
Loo
p
s
 
s
t
a
t
em
e
n
ts
 
a
r
e
 
use
d
 
wh
e
n
 
w
e
 
ne
e
d
 
t
o
 
r
u
n
 
sam
e
 
c
ode
a
g
ain
 
and
 
a
g
ain.
P
ython
 
I
t
e
r
a
ti
o
n
 
(Loo
p
s
)
 
s
t
a
t
em
e
n
ts
 
a
r
e
 
o
f
 
th
r
ee
 
type
 
:
-
1.
Wh
i
le
 
L
o
op
2.
F
o
r
 
L
o
op
3.
Ne
s
t
ed
 
F
o
r
 
Lo
o
p
s
Visit School Website for Regular Updates
 
                     
I
t
e
r
a
ti
on
 
S
t
a
t
eme
n
ts
 
(Loop
s
)
1
.
 
Wh
i
le
 
Loop
I
t
 
 
is
 
 
use
d
 
 
t
o
 
 
e
x
ecu
t
e
 
 
a
 
 
b
l
oc
k
 
 
o
f
 
 
s
t
a
t
eme
n
t
 
 
as
 
 
l
on
g
 
 
as
 
 
a
 
 
gi
v
en
c
ond
iti
o
n
 
 
is
 
 
true
.
 
 
And
 
 
when
 
 
the
 
 
c
ond
iti
o
n
 
 
b
e
c
om
e
 
 
f
al
se
,
 
 
the
c
o
n
t
r
o
l
 
wi
l
l
 
c
om
e
 
ou
t
 
o
f
 
the
 
l
o
o
p
.
 
Th
e
 
c
ond
iti
o
n
 
is
 
ch
e
c
k
ed
 
e
v
e
r
y
ti
me
 
a
t
 
the
 
beg
i
nn
i
n
g
 
o
f
 
the
 
l
o
o
p.
S
y
n
ta
x
w
h
i
l
e
 
(c
o
nd
iti
o
n
):
s
tat
e
m
e
n
t
[
s
tat
e
m
e
n
ts]
e
.
g
.
x
 
=
 
1
whil
e
 
(x
 
<
=
 
4):
pr
i
n
t(
x
)
x
 
=
 
x
 
+
 
1
Ou
t
put
1
2
3
4
Visit School Website for Regular Updates
I
t
e
r
a
ti
o
n
 
S
t
a
t
eme
n
ts
 
(Loop
s
)
Wh
i
le
 
L
o
o
p
 
c
o
n
ti
nue
Whi
l
e
 
Lo
o
p
 
With Else
e
.
g.
x
 
=
 
1
whi
l
e
 
(
x
 
<
 
3
):
pr
i
n
t('i
ns
i
d
e
 
whi
l
e
 
l
oo
p
 
v
al
u
e
 
o
f
 
x
 
is
 
',x)
x
 
=
 
x
 
+
 
1
e
lse:
pr
i
n
t('i
ns
i
d
e
 
e
ls
e
 
v
al
u
e
 
o
f
 
x
 
is
 
',
 
x
)
O
u
tput
i
ns
i
d
e
 
whi
l
e
 
l
oo
p
 
v
al
u
e
 
o
f
 
x
 
is
 
1
i
ns
i
d
e
 
whi
l
e
 
l
oo
p
 
v
al
u
e
 
o
f
 
x
 
is
 
2
i
n
s
i
d
e
 
e
l
s
e
 
v
a
lu
e
 
o
f
 
x
 
is
 
5
*
W
r
i
t
e
 
a
 
p
r
og
r
am
 
in
 
p
y
thon
 
t
o
 
f
i
n
d
 
ou
t
 
the
 
f
ac
t
or
i
al
 
o
f
 
a
 
g
i
v
en
 
n
umber
Visit School Website for Regular Updates
I
t
e
r
a
ti
o
n
 
S
t
a
t
eme
n
ts
 
(L
o
op
s
)
Wh
i
le
 
L
o
o
p
 
c
o
n
ti
nue
I
n
f
i
n
i
t
e
 
Wh
i
l
e
 
Lo
o
p
e
.
g.
x
 
=
 
5
while
 
(
x
 
=
=
 
5):
pr
i
n
t
(‘inside l
o
op
'
)
Output
In
s
i
d
e
 
l
o
op
In
s
i
d
e
 
l
oop
Visit School Website for Regular Updates
I
t
e
r
a
ti
o
n
 
S
t
a
t
eme
n
ts
 
(Loop
s
)
2.
 
F
o
r
 
Loop
It
 
is
 
use
d
 
t
o
 
i
t
e
r
a
t
e
 
o
v
er
 
i
t
ems
 
o
f
 
a
n
y
 
sequ
e
nc
e,
 
suc
h
 
as
 
a
 
li
s
t
o
r
 
a
 
s
tri
n
g.
S
y
n
t
a
x
f
o
r
 
v
al
 
in
 
sequenc
e
:
s
t
a
t
em
e
n
ts
e
.
g.
f
o
r
 
i
 
in
 
r
an
g
e
(
3,
5
):
pr
i
n
t(i)
Output
3
4
Visit School Website for Regular Updates
 
                    
I
t
e
r
a
ti
on
 
S
t
a
t
eme
n
ts
 
(Loop
s
)
2.
 
F
o
r
 
Loo
p
 
c
o
n
t
i
nue
E
x
ampl
e
 
p
r
o
g
r
ams
f
o
r
 
i
 
in
 
r
an
g
e
(
5,
3
,-
1):
pr
i
n
t(i)
Output
5
4
r
an
g
e
(
)
 
Fun
c
ti
o
n
 
P
a
r
ame
t
e
r
s
s
t
ar
t
:
 
S
t
art
i
n
g
 
n
umbe
r
 
o
f
 
the
 
sequen
c
e.
s
t
o
p:
 
G
e
ne
r
at
e
 
n
u
mbe
r
s
 
u
p
 
t
o
,
 
b
u
t
 
no
t
 
i
n
c
l
ud
i
n
g
 
this
 
n
u
mbe
r
.
s
t
ep(
Opt
i
ona
l
)
:
 
D
e
t
er
m
i
ne
s
 
the
 
i
nc
r
e
m
e
n
t
 
b
e
t
w
een
 
each
 
n
u
mbe
r
s
 
in
 
the
s
e
quen
c
e.
Visit School Website for Regular Updates
I
t
e
r
a
ti
o
n
 
S
t
a
t
eme
n
ts
 
(Loop
s
)
2.
 
F
o
r
 
Loo
p
 
c
o
n
t
i
nue
For
 
Loop
 
With E
l
se
e
.
g.
f
o
r
 
i
 
in
 
r
an
g
e
(
1,
 
4):
pr
i
n
t(i)
el
s
e:
 
#
 
E
x
e
c
u
t
ed
 
be
c
ause
 
n
o
 
b
r
eak
 
in
 
f
or
pr
i
n
t("No
 
B
r
ea
k
")
O
u
tput
1
2
3
4
No
 
B
r
eak
 
Visit School Website for Regular Updates
Visit School Website for Regular Updates
I
t
e
r
a
ti
o
n
 
S
t
a
t
eme
n
ts
 
(Loop
s
)
2.
 
F
o
r
 
Lo
o
p
 
c
o
n
ti
nue
Ne
st
ed
 
F
o
r
 
Lo
o
p
e
.
g.
f
o
r
 
i
 
in
 
r
an
g
e
(
1,
3
):
f
o
r
 
j
 
in
 
r
an
g
e
(
1,
1
1):
k=i*j
pr
i
n
t
 
(k
,
 
end=
'
 
'
)
pr
i
n
t
()
Output
1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
10
2
 
4
 
6
 
8
 
10
 
1
2
 
14
 
1
6
 
18
 
2
0
Visit School Website for Regular Updates
I
t
e
r
a
ti
o
n
 
S
t
a
t
eme
n
ts
 
(L
o
op
s
)
3.
 
Jump
 
S
t
a
t
eme
n
ts
Jump
     
 
s
tat
em
e
n
ts
     
 
a
r
e
     
 
us
e
d
     
 
t
o
     
 
t
r
a
n
s
f
er
th
e
 
p
r
o
g
r
a
m's
 
c
o
n
t
r
o
l
 
f
r
o
m
 
o
n
e
 
l
o
c
a
ti
o
n
 
t
o
 
anot
h
e
r
.
 
Means
these
 
a
r
e
 
us
e
d
 
t
o
 
al
t
er
 
t
h
e
 
f
l
ow
 
o
f
 
a
 
l
o
o
p
 
li
k
e
 
-
 
t
o
 
sk
ip
 
a
 
part
o
f
 
a
 
l
o
o
p
 
o
r
 
t
e
r
mi
n
a
t
e
 
a
 
l
oop
T
h
e
r
e
 
a
r
e
 
th
r
ee
 
types
 
o
f
 
jum
p
 
s
tat
em
e
n
ts
 
use
d
 
in
 
p
y
th
o
n.
1
.
b
r
eak
2
.
c
o
n
ti
nue
3
.
pass
Visit School Website for Regular Updates
 
                     
I
t
e
r
a
ti
on
 
S
t
a
t
eme
n
ts
 
(Loop
s
)
1
.
b
r
eak
i
t
 
is
 
u
s
ed
 
t
o
 
t
e
r
mi
n
a
t
e
 
the
 
l
o
o
p.
e
.
g.
f
o
r
 
v
al
 
in
 
"
s
tri
ng":
if
 
v
al
 
=
=
 
"
i
":
b
r
eak
pr
i
n
t(
v
al)
pr
i
n
t("The
 
end
")
O
u
tput
s
t
r
T
h
e
 
end
Visit School Website for Regular Updates
I
t
e
r
a
ti
o
n
 
S
t
a
t
eme
n
ts
 
(L
o
op
s
)
2
.
c
o
n
ti
nue
I
t
 
is
 
us
e
d
 
t
o
 
sk
ip
 
all
 
the
 
r
em
a
i
n
i
n
g
 
s
t
a
t
em
e
n
ts
 
in
 
the
l
o
o
p
 
and
 
m
o
v
e
 
c
o
n
t
r
o
ls
 
bac
k
 
t
o
 
the
 
t
o
p
 
o
f
 
the
 
l
o
o
p.
e
.
g.
f
o
r
 
v
al
 
in
 
"i
n
i
t
":
if
 
v
al
 
=
=
 
"
i
":
c
o
n
ti
nue
pr
i
n
t(
v
a
l
)
pr
i
n
t
("Th
e
 
en
d
")
O
u
tput
n
t
Th
e
 
end
Visit School Website for Regular Updates
 
                       
I
t
e
r
a
ti
on
 
S
t
a
t
eme
n
ts
 
(
Loop
s
)
3
.
 
pas
s
 
S
ta
t
em
e
n
t
Th
is
 
s
t
a
t
eme
n
t
 
doe
s
 
noth
i
n
g
.
 
I
t
 
c
an
 
b
e
 
use
d
 
when
 
a
 
s
tat
eme
n
t
 
is
r
equi
r
ed
 
s
y
nt
acti
c
ally
 
bu
t
 
th
e
 
p
r
o
g
r
am
 
r
equ
i
r
es
 
n
o
 
acti
on
.
Use
 
in
 
l
o
o
p
while
 
T
ru
e
:
pas
s
 
 
#
 
Bu
s
y
-
w
ait
 
f
o
r
 
k
e
y
b
oa
r
d
 
i
nt
er
r
up
t
 
(
Ctr
l
+C)
In
 
funct
i
on
I
t
 
ma
k
es
 
a
 
c
o
n
t
r
o
l
l
er
 
t
o
 
pas
s
 
b
y
 
w
i
thout
 
e
x
ecuti
n
g
 
a
n
y
 
c
od
e.
e
.
g.
d
e
f
 
m
y
fu
n
():
pass
 
#if 
w
e do
n
’t
 
use pass
 
he
r
e then
 
er
r
or m
e
s
s
a
g
e
 
w
i
ll
 
be
 
sh
o
wn
pr
i
n
t
(‘
m
y
 
p
r
og
r
a
m
')
O
UTPUT
My
 
p
r
o
g
r
am
Visit School Website for Regular Updates
I
t
e
r
a
ti
o
n
 
S
t
a
t
eme
n
ts
 
(Loop
s
)
3
.
 
pas
s
 
S
ta
t
eme
n
t
 
c
o
n
ti
nue
e
.
g.
f
o
r
 
i
 
in
 
'i
n
i
ti
a
l':
i
f
(i
 
=
=
 
'
i
'):
pass
e
lse:
pr
i
n
t
(
i
)
OUTP
U
T
n
t
a
L
N
O
T
E
 
 
:
 
 
c
o
n
ti
nu
e
 
 
f
o
r
c
e
s
 
 
the
 
 
l
o
o
p
 
 
t
o
 
 
s
t
art
 
 
a
t
 
 
t
he
 
 
n
e
x
t
 
 
i
t
e
r
a
ti
on
whil
e
 
 
pas
s
 
 
me
a
n
s
 
 
"th
e
r
e
 
 
is
 
 
n
o
 
 
c
od
e
 
 
t
o
 
 
e
x
e
c
u
t
e
 
 
he
r
e"
 
 
and
will
 
c
o
n
ti
nu
e
 
th
r
ou
g
h
 
the
 
r
em
a
i
nde
r
 
o
r
 
the
 
l
o
o
p
 
bod
y
.
Visit School Website for Regular Updates
Slide Note
Embed
Share

Comprehensive overview of Python programming language covering its introduction, features, shortcomings, and how to work in Python interactive and script mode. The content also emphasizes the importance of Python in software development, web development, system scripting, and mathematics alongside providing insights on its syntax, interpretation, cross-platform compatibility, library support, and more. Visit the school website for regular updates.

  • Python Basics
  • Computer Science
  • CBSE Board
  • Programming Language
  • Software Development

Uploaded on Aug 02, 2024 | 2 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. New syllabus 2020-21 Chapter1 Revision of the Basics of Python Computer Science Class XII ( As per CBSE Board) Visit School Website for Regular Updates

  2. Introduction It is widely used general purpose,high level programming language.Developed by Guido van Rossum in 1991. It is used for: software development, web development (server-side), system scripting, Mathematics. Visit School Website for Regular Updates

  3. Features of Python 1. Easy to use Due to simple syntax rule 2. Interpreted language Code execution & interpretation line by line 3. Cross-platform language It can run on windows,linux,macinetosh etc. equally 4. Expressive language Less code to be written as it itself express the purpose of the code. 5. Completeness Support wide rage of library 6. Free & Open Source Can be downloaded freely and source code can be modify for improvement Visit School Website for Regular Updates

  4. Shortcomings of Python 1. Lesser libraries as compared to other programming languages like c++,java,.net 2. Slow language as it is interpreted languages,it executes the program slowly. 3. Weak on Type-binding It not pin point on use of a single variable for different data type. Visit School Website for Regular Updates

  5. How to work in Python (i) in Interactive mode * Search the python.exe file in the drive in which it is installed. If found double click it to start python in interactive mode Visit School Website for Regular Updates

  6. How to work in Python * Click start button -> All programs -> python<version>->IDLE(Python GUI) Visit School Website for Regular Updates

  7. How to work in Python Python command prompt >>> Type the following at prompt print hello print 8*3 print 3**3 k=3+4*3 print k Visit School Website for Regular Updates

  8. How to work in Python (ii) in Script mode Step 1 (Create program file) Below steps are for simple hello world program a. Click Start button->All Programs -> Python<version>->IDLE b.Now click File->New in IDLE Python Shell Now type print hello print world print python is , objectoriented programming lang. c. Click File->Save and then save the file with filename and .py extension Visit School Website for Regular Updates

  9. How to work in Python (ii) in Script mode Step 2 (Run program file) a. ClickOpen command from IDLE s File menu and select the file you have already saved b. ClickRun-> Run Module c. It will execute all the commands of program file and display output in separate python shell window Note :- Python comes in 2 flavours python 2.x and python 3.x . Later one is Backward incompatible language as decide by Python Software foundation(PSF). Mean code written in 2.x will not execute on 3.x . Visit the below link for difference between 2.x & 3.x https://www.geeksforgeeks.org/important-differences-between-python-2-x-and- python-3-x-with-examples/ Visit School Website for Regular Updates

  10. Data Handling programming Most of the computer language support data type, variables,operator and expression like fundamentals.Python also support these. Data Types Data Type specifies which type of value a variable can store. type() function is used to determine a variable's type in Python. Visit School Website for Regular Updates

  11. Data type continue Data Types In Python 1. Number 2. String 3. Boolean 4. List 5. Tuple 6. Set 7. Dictionary Visit School Website for Regular Updates

  12. Data type continue 1. Number In Python It is used to store numeric values Python has three numeric types: 1. Integers 2. Floating point numbers 3. Complex numbers. Visit School Website for Regular Updates

  13. Data type continue 1. Integers Integers or int are positive or negative numbers with no decimal point. Integers in Python 3 are of unlimited size. e.g. a= 100 b= -100 c= 1*20 print(a) print(b) print(c) Output :- 100 -100 200 Visit School Website for Regular Updates

  14. Data type continue Type Conversion of Integer int() function converts any data type to integer . e.g. a = "101" # string b=int(a) # converts string data type to integer . c=int(122.4) # converts float data type to integer . print(b) print(c)Run Code Output :- 101 122 Visit School Website for Regular Updates

  15. Data type continue 2. Floating point numbers It is a positive or negative real numbers with a decimal point. e.g. a = 101.2 b = -101.4 c = 111.23 d = 2.3*3 print(a) print(b) print(c) print(d)Run Code Output :- 101.2 -101.4 111.23 6.8999999999999995 Visit School Website for Regular Updates

  16. Data type continue Type Conversion of Floating point numbers float() function converts any data type to floating point number. e.g. a='301.4'#string b=float(a) #converts string data type to floating point number . c=float(121) #converts integer data type to floating point number . print(b) print(c)Run Code Output :- 301.4 121.0 Visit School Website for Regular Updates

  17. Data type continue 3. Complex numbers Complex numbers are combination of a real and imaginary part.Complex numbers are in the form of X+Yj, where X is a real part and Y is imaginary part. e.g. a = complex(5) # convert 5 to a real part val and zero imaginary part print(a) b=complex(101,23) #convert 101 with real part and 23 as imaginary part print(b) Output :- (5+0j) (101+23j) Visit School Website for Regular Updates

  18. Data type continue 2. String In Python A string is a sequence of characters. In python we can create string using single (' ') or double quotes (" ").Both are same in python.e.g. str='computer science' print('str-', str) # print string print('str[0]-', str[0]) # print first char 'h' print('str[1:3]-', str[1:3]) # print string from postion 1 to 3 'ell' print('str[3:]-', str[3:]) # print string staring from 3rd char 'llo world' print('str *2-', str *2 ) # print string two times print("str +'yes'-", Output str- computer science str[0]- c str[1:3]- om str[3:]- puter science str *2- computer sciencecomputer science str +'yes'- computer scienceyes str +'yes') # concatenated string Visit School Website for Regular Updates

  19. Data type continue Iterating through string e.g. str='comp sc' for i in str: print(i) Output c o m p s c Visit School Website for Regular Updates

  20. Data type continue 3. Boolean In Python It is used to store two possible values either true or false e.g. str="comp sc" boo=str .isupper() # test if string contains upper case print(boo) Output False Visit School Website for Regular Updates

  21. Data type continue 4.List In Python List are collections of items and each item has its own index value. 5. Tuple In Python List and tuple, both are same except ,a list is mutable python objects and tuple is immutable Python objects. Immutable Python objects mean you cannot modify the contents of a tuple once it is assigned. e.g. of list list =[6,9] list[0]=55 print(list[0]) print(list[1]) print(tup[1]) e.g. of tuple tup=(66,99) Tup[0]=3 # error messagewill be displayed print(tup[0]) OUTPUT 55 9 Visit School Website for Regular Updates

  22. Data type continue 6. Set In Python It is an unordered collection of unique and immutable (which cannot be modified)items. e.g. set1={11,22,33,22} print(set1) Output {33, 11, 22} Visit School Website for Regular Updates

  23. Data type continue 7. Dictionary In Python It is an unordered collection of items and each item consist of a key and a value. e.g. dict = {'Subject':'compsc', 'class': '11'} print(dict) print ("Subject : ", dict['Subject']) print ("class : ", dict.get('class')) Output {'Subject': 'comp sc', 'class': '11'} Subject : comp sc class : 11 Visit School Website for Regular Updates

  24. Operator Operators are special symbols in Python that carry out arithmetic or logical computation. The value that the operator operates on is called the operand. Arithmetic operators Used for mathematical operation Operator Meaning Example + Add two operands or unary plus x + y +2 - Subtract right operand fromthe left or unary minus x - y -2 * Multiply two operands x * y / Divide left operand by the right one (always results into float) x / y % Modulus - remainder of the division of left operand by the right x % y (remainder of x/y) // Floordivision - division that results into whole number adjusted to the left in the number line x // y ** Exponent - left operand raised to the power ofright x**y (x to the powery) Visit School Website for Regular Updates

  25. Operator continue Arithmatic operator continue e.g. x = 5 y = 4 print('x + y =',x+y) print('x - y =',x-y) print('x * y =',x*y) print('x / y =',x/y) print('x // y =',x//y) print('x ** y =',x**y) OUTPUT ('x + y =', 9) ('x - y =', 1) ('x * y =', 20) ('x / y =', 1) ('x // y =', 1) ('x ** y =', 625) Write a program in python to calculate the simple interest based on entered amount ,rate and time Visit School Website for Regular Updates

  26. Operator continue Arithmatic operator continue # EMI Calculator program in Python def emi_calculator(p, r, t): r = r / (12 * 100) # one month interest t = t * 12 # one month period emi = (p * r * pow(1 + r, t)) / (pow(1 + r, t) - 1) return emi # driver code principal = 10000; rate = 10; time = 2; emi = emi_calculator(principal, rate, time); print("Monthly EMI is= ", emi) Visit School Website for Regular Updates

  27. Operator continue Arithmatic operator continue How to calculate GST GST ( Goods and Services Tax ) which is included in netprice of product for get GST % first need to calculate GST Amount by subtract original cost from Netprice and then apply GST % formula = (GST_Amount*100) / original_cost # Python3 Program to compute GST from original and net prices. def Calculate_GST(org_cost, N_price): # return value after calculate GST% return (((N_price - org_cost) * 100) / org_cost); # Driver program to test above functions org_cost = 100 N_price = 120 print("GST = ",end='') print(round(Calculate_GST(org_cost, N_price)),end='') print("%") * Write a Python program to calculate the standard deviation Visit School Website for Regular Updates

  28. Operator continue Comparison operators -used to compare values Operator Meaning Example > Greater that - True if left operand is greater than the right x > y < Less that - True if left operand is less than the right x < y == Equal to - True if both operands are equal x == y != Not equal to - True if operands are not equal x != y >= Greater than or equal to - True if left operand is greater than or equal to the right x >= y <= Less than or equal to - True if left operand is less than or equal to the right x <= y Visit School Website for Regular Updates

  29. Operator continue Comparison operators continue e.g. x = 101 y = 121 print('x > y is',x>y) print('x < y is',x<y) print('x == y is',x==y) print('x != y is',x!=y) print('x >= y is',x>=y) print('x <= y is',x<=y) Output ('x > y is', False) ('x < y is', True) ('x == y is', False) ('x != y is', True) ('x >= y is', False) ('x <= y is', True) Visit School Website for Regular Updates

  30. Operator continue Logical operators Operator Meaning Example and True if both the operands are true x and y or True if either of the operands is true x or y not True if operand is false (complements the operand) not x e.g. x = True y = False print('x and y is',x and y) print('x or y is',x or y) print('not x is',not x) Outpur ('x and y is', False) ('x or y is', True) ('not x is', False) Visit School Website for Regular Updates

  31. Operator continue Bitwise operators Used to manipulate bit values. Operator Meaning Example & Bitwise AND x& y | Bitwise OR x | y ~ ~x Bitwise NOT ^ Bitwise XOR x ^ y >> Bitwise right shift x>> 2 << Bitwise left shift x<< 2 Visit School Website for Regular Updates

  32. Operator continue Bitwise operators continue a = 6 b = 3 print ('a=',a,':',bin(a),'b=',b,':',bin(b)) c = 0 c = a & b; print ("result of AND is ", c,':',bin(c)) c = a | b; print ("result of OR is ", c,':',bin(c)) c = a ^ b; print ("result of EXOR is ", c,':',bin(c)) c = ~a; print ("result of COMPLEMENT is ", c,':',bin(c)) c = a << 2; print ("result of LEFT SHIFT is ", c,':',bin(c)) c = a >> 2; print ("result of RIGHT SHIFT is ", c,':',bin(c)) Output ('a=', 6, ':', '0b110', 'b=', 3, ':', '0b11') ('result of AND is ', 2, ':', '0b10') ('result of OR is ', 7, ':', '0b111') ('result of EXOR is ', 5, ':', '0b101') ('result of COMPLEMENT is ', -7, ':', '-0b111') ('result of LEFT SHIFT is ', 24, ':', '0b11000') ('result of RIGHT SHIFT is ', 1, ':', '0b1') Visit School Website for Regular Updates

  33. Operator continue Python Membership Operators T est for membership in a sequence Operator Description in Evaluates to true if it finds a variable in the specified sequence and false otherwise. Evaluates to true if it does not finds a variable in the specified sequence and false otherwise. not in e.g. a = 5 b = 10 list = [1, 2, 3, 4, 5 ] if ( a in list ): print ("Line 1 - a is available in the given list") else: print ("Line 1 - a is not available in the given list") if ( b not in list ): print ("Line 2 - b is not available in the given list") else: print ("Line 2 - b is available in the given list") output Line 1 - a is available in the given list Line 2 - b is not available in the given list Visit School Website for Regular Updates

  34. Operator continue Python Identity Operators Operat or Description is Evaluatesto trueif the variablesoneithersideof the operatorpointto the same object and false otherwise. is not Evaluatesto false if the variableson eithersideof the operatorpointto the same object and true otherwise. e.g. a = 10 b = 10 print ('Line 1','a=',a,':',id(a), 'b=',b,':',id(b)) if ( a is b ): print ("Line 2 - a and b have same identity") else: print ("Line 2 - a and b do not have same identity") OUTPUT ('Line 1', 'a=', 10, ':', 20839436, 'b=', 10, ':', 20839436) Line 2 - a and b have same identity Visit School Website for Regular Updates

  35. Operator continue Operators Precedence :highest precedence to lowest precedence table Operator Description ** Exponentiation(raise to the power) ~ + - Complement, unary plus and minus (method names for the last two are +@ and -@) * / % // Multiply,divide, modulo and floor division + - Addition and subtraction >> << Right and left bitwise shift & Bitwise 'AND'td> ^ | Bitwise exclusive `OR' and regular `OR' <= < > >= Comparison operators <> == != Equality operators = %= /= //= -= += *= **= Assignment operators is is not Identityoperators in not in Membership operators not or and Logical operators Visit School Website for Regular Updates

  36. Expression It is a valid combination of operators,literals and variable. 1. Arithmatic expression :- e.g. c=a+b 2. Relational expression :- e.g. x>y 3. Logical expression :- a or b 4. String expression :- c= comp + sc Visit School Website for Regular Updates

  37. Type conversion The process of converting the value of one data type (integer, string, float, etc.) to another data type is called type conversion. Python has two types of type conversion. Implicit Type Conversion Explicit Type Conversion Implicit Type Conversion: In Implicit type conversion, Python automatically converts one data type to another data type. This process doesn't need any user involvement. e.g. num_int = 12 num_flo = 10.23 num_new = num_int + num_flo print("datatype of num_int:",type(num_int)) print("datatype of num_flo:",type(num_flo)) print("Value of num_new:",num_new) print("datatype of num_new:",type(num_new)) OUTPUT ('datatype of num_int:', <type 'int'>) ('datatype of num_flo:', <type 'float'>) ('Value of num_new:', 22.23) ('datatype of num_new:', <type 'float'>) Visit School Website for Regular Updates

  38. Type conversion Explicit Type Conversion: In Explicit Type Conversion, users convert the data type of an object to required data type. We use the predefined functions like int(),float(),str() etc. e.g. num_int = 12 num_str = "45" print("Data type of num_int:",type(num_int)) print("Data type of num_str before Type Casting:",type(num_str)) num_str = int(num_str) print("Data type of num_str after Type Casting:",type(num_str)) num_sum = num_int + num_str print("Sum of num_int and num_str:",num_sum) print("Data type of the sum:",type(num_sum)) OUTPUT ('Data type of num_int:', <type 'int'>) ('Data type of num_str before Type Casting:', <type 'str'>) ('Data type of num_str after Type Casting:', <type 'int'>) ('Sum of num_int and num_str:', 57) ('Data type of the sum:', <type 'int'>) Visit School Website for Regular Updates

  39. math module It is a standard module in Python. To use mathematical functions of this module,we have to import the module using import math. Function Description Example ceil(n) It returns the smallest integer greater than or equal to n. math.ceil(4.2) returns 5 factorial(n) It returns the factorial of value n math.factorial(4) returns 24 floor(n) It returns the largest integer less than or equal to n math.floor(4.2) returns 4 fmod(x, y) It returns the remainder when n is divided by y math.fmod(10.5,2) returns 0.5 exp(n) It returns e**n math.exp(1) return 2.718281828459045 log2(n) It returns the base-2 logarithm of n math.log2(4) return 2.0 log10(n) It returns the base-10 logarithm of n math.log10(4) returns 0.6020599913279624 pow(n, y) It returns n raised to the power y math.pow(2,3) returns 8.0 sqrt(n) It returns the square root of n math.sqrt(100) returns 10.0 cos(n) It returns the cosine of n math.cos(100) returns 0.8623188722876839 sin(n) It returns the sine of n math.sin(100) returns -0.5063656411097588 tan(n) It returns the tangent of n math.tan(100) returns -0.5872139151569291 pi It is pi value (3.14159...) It is (3.14159...) e It is mathematical constant e (2.71828...) It is (2.71828...) Visit School Website for Regular Updates

  40. Control Statements Control statements are used to control the flow of executiondepending upon the specified condition/logic. There are three types of control statements. 1. Decision Making Statements 2. Iteration Statements(Loops) 3. Jump Statements(break, continue, pass) Visit School Website for Regular Updates

  41. Decision Making Statement Decision making statement used to control the flow of execution of program depending upon condition. There are three types of decision making statement. 1. if statements 2. if-else statements 3. Nested if-else statement Visit School Website for Regular Updates

  42. Decision Making Statement 1. if statements An if statement is a programming statement that, if proved true, performs a or displays information. conditional function Visit School Website for Regular Updates

  43. Decision Making Statement 1. if statements Syntax: if(condition): statement [statements] e.g. noofbooks = 2 if (noofbooks == 2): print('Youhave ') print( two books ) print( outside of if statement ) Output You have two books Note:To indicate a block of code in Python, you must indent each line of the block by the same amount. In above e.g. both print statements are part of if conditionbecause of both are at same level indented but not the third print statement. Visit School Website for Regular Updates

  44. Decision Making Statement 1. if statements Using logical operator in if statement x=1 y=2 if(x==1 and y==2): print( condition matcing the criteria') Output :- condition matcing the criteria ----------------------------------------------------------- a=100 if not(a == 20): print('a is not equal to 20') Output :- a is not equal to 20 Visit School Website for Regular Updates

  45. Decision Making Statement 2. if-else Statements If-else statement executes some code if the test expression is true (nonzero) and some other code if the test expression is false. Visit School Website for Regular Updates

  46. Decision Making Statement 2. if-else Statements Syntax: if(condition): statements else: statements e.g. a=10 if(a < 100): print( less than 100') else: print( more than equal 100') OUTPUT less than 100 *Write a program in pythonto check that entered numer is even or odd Visit School Website for Regular Updates

  47. Decision Making Statement 3. Nested if-else statement The nested if...else statement allows you to check for multiple test expressions and execute different codes for more than two conditions. Visit School Website for Regular Updates

  48. Decision Making Statement 3.Nested if-else statement Syntax If (condition): statements elif (condition): statements else: statements E.G. num = float(input("Enter a number: ")) if num >= 0: if num == 0: print("Zero") else: print("Positive number") else: print("Negative number") OUTPUT Enter a number: 5 Positive number * Write python program to findout largest of 3 numbers. Visit School Website for Regular Updates

  49. Iteration Statements (Loops) Iteration statements(loop) are used to execute a block of statementsas long as the condition is true. Loops statements are used when we need to run same code again and again. Python Iteration (Loops) statementsare of three type :- 1. While Loop 2. For Loop 3. Nested For Loops Visit School Website for Regular Updates

  50. Iteration Statements (Loops) 1. While Loop It is used to execute a block of statement as long as a given condition is true. And when the condition become false, the control will come out of the loop. The condition is checked every time at the beginning of the loop. Syntax while (condition): statement [statements] e.g. x = 1 while (x <= 4): print(x) x = x + 1 3 4 Output 1 2 Visit School Website for Regular Updates

Related


More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#