Mid-i Assignment Copy
Mid-i Assignment Copy
242|1 A05 JW
PyTHON AS51GNMENT
nu C!, 2,3,0
Paintl litCi3) pçydu 2
prúvd(atC33)
num [',2,3)
fon nwwmb n im:
put(nuwm)
Qutput
2
Kut Mthei
4. appendl) Ad van e m n t
iv, mel):
Gcurnea vale.
rumm C', 2,3,1,2,3)
num. umae(2)
pint(em) C,3.1,2,3]
V. pepl) Rums an elmnt by indel dufaut last)
the elmnt
t th nd.
Plntlnun t# (1,2,3,4,5]
prnt Cnwm) tt Ci,3 4,5J
um CI,2,3)
numz Cl,2,3]
phintlnwum)
2.
Enplain Pythen pestos.
Sn pytnen, oporotons n qnnal pufoun
operaians Nals a d vaniabs.
1 Aithemotie Orsates
i thematie pualons se
Pythan
basie mathemaical opuration ike vaddien
ubthactism, iplication and diision
Rast
Subiats b e (a-b)
Multiplies a nbes
Rumainder hn a s disidd
b
Progham
b= 5
paint ("Aditien o , a tb
paint (" Subtotion e a and b:"
psnt (" ultiplipatisn a*b)
pittl Stislsm:, alb)
2 Compawion Openaloyi
hee opatos compas h wales 6 eitt stuns
Tue Co) talu acconing to He couditin
Openats Resut
valu
qotud Rhan H sesn.
the
Ritus tu i kt valus
quat fha ohe equal te secsnd.
eual to second.
13
b=33
psuntlsb)
print (acb)
psi t (a>xb)
print (a!b)
prnt (a b)
pint lac=)
Qutput:
Bale
Te
Tue
tale
eaical Openato -
Pytn sqical spates porlom koqical AD,
Dqieal OR, Leeal NOTopatiens. 9t s used to
cembine condit'nal stoment.
NOT
G Zoqieal
Prognam:
P l t (a andb)
print st a)
Otputi
Tue
talse
and
Sik- by-bit operas. he
yunbes.
he Bitusi epehate
AND
i) Bitui oR
(iy Bitusise XOR
NOT
Prsqami
b 4
pint(aeb)
print lalb)
pint (a^b)
print (as
prunt (a<<)
Skput
5. Aasiomenl Qpenalei
The pythen
asin vals
Assioand eperato a
Hhe vaials
vol
eperand
bea
print(6)
b+=a
Pantl6)
printlo)
bt2 a
prnttb)
bt< a
pntcb)
Output:
20
I0240o
6. 3dnty pratss
Pythen, is
t themuey 2
vahiabls khat
equal dont inly (Bhat
Lahe idtical.
Tue
not idntial
Phoaanm:
aAo
b 20
Phint ( a not b)
Qutput
Tsu
Tsu
Sutput
Tu
3Wit n conseuis
typ(s)
duet: C o t
aciCoet wti to tinq
cu Coet ntu to Ascu haoetu
Preghamn
Sy'
ba eat. (a)
Print(b)
pi nt(c
print (c)
psintlc
9tput:
00
5
Ox38
uc map)
Syntan: Janda [anqeunt (s)]: enpwisn
canditisn
emt bad
with
he
’Taks hnction ond a wtaable sbject
Appies a tunctrion
pÀnt (sgyan)
Qutput: C,4,4,ib,53
Sting Operatiosi
tut
b weld'
print(c)
Qutput hulloused
W): Concalnas
thing:
Prognam
phint (ey
i) hduxing and slicinq!
a chahactu
adiina
sting oaud on
Siclng porkin
taing
Sahina
Salna
Sahi
(iv) Munbeship:
nat
tur
stina,
a = Agthon'
epint(''
Pint ('t' n a)
tut eugh Hhe
sing'
arSahiahna
phint (iam)