0% found this document useful (0 votes)
15 views9 pages

Cs HHW

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)
15 views9 pages

Cs HHW

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/ 9

classmate

Date

Page

olo+z
HW-1
VQty
hch
Heliday
the pollaung
connot le
,
wseo
id hose identpns
fo hamng analles
2Ttól
2)
D9 lurctions

hhile
tax
in a Pytho
523rd ous
po
frally
Csluin 31
42Swit &2TotaL
etal *tax, 3d Rous, ially,Coun 3l
these iolentiliors lwotit cannst leweod fer
naming aiabia o9 functiorns.

2Dut f the follainy, Lind huse identifani , huch

pylhen pugam. des


ay Ret Fo,Apite,lend Tolalg
Says * Rent, aanl toal,
identline otich carnit e csed.
Laro thse

32 Name
ndng seied eccusence m n madam

Ans 2
2lit.
at te position

ndlek Citem
an itm the lit

4 hhch sting method s wsed to inplemet the

To cait the nlusaler chakactrs in the


To chunge Mhe fst cdharacoh the sring'
in capilal lette

7o check grenis lettes 94a numles.


hetthes

change lowrrase to ugoercase leti


Change. one chaath to ansthes chaace
clssmate
Date

)
Page

Anst Sta. count l


Stcaptalige ()
22Sth Lsalnum C)
St.upeHl
5) St eplace C)
5. Holut many tns will Pyten aLte dAe
cate inside the felowng

while i <0 anel i>2:

i= i+)
AnsPythen uill nt exate this Code lecaue
e a 4ii initialied to O ROdlsent
sotily dhe gien ccnditon se dha loep is
ppes entisaly and naner ectd.
Reiik dhe folouring fot losp it whle laqpi
fon a in
tiange C26, s00, 25):
punt a

shileao<500
print (a)
a=0t 25

pointla)
a=9O
ashileas 9:

pint a
classMAte

Date

Page

&. Hhe ne.


WAPto npt and to fnd
any bung
AusS= (E
ssols
nput
tS.&plit
n the

(4
tiing
ntar th
")
tung
w= len lt) 39
pnt (e no. The w in the rung

9Wte a
geneato functionperratasa, ()that
diplays
angunant
Ans def genenallsq(n):
for Ln Aange Cioo,n+1):
O.5
pint lsa)

geneaataAq (a)
alassMte
Date
Page

o5lo5l24
Helelay HW2
1State
la boeak
Teue b False
statmeit gien
: is
In a pyloh pagPan
n a reAted

loop it totinatis the ekecutien all

losps in she ge 3" False

2. kluih tha folleuing sill otelat keyvala


om ?
puis
delete
del
lo

D1 (
D1
key
Nane
Nane
Name
")
7
a

D1[Nane
c) del.

d) D1del «Nam
dict. DI

"
3. Consuoler Hhe statmett given belou hen

horssethe coect output


pude = # a2O
20 Pesidnsy

2 nds (b)2 ciePo


(c)O ceiep

4 hich he statls) wsulo gien


lollsusing

dig
ereciton dae folloung co?
tup =(20, B0,40, 50,80,792
pint (tup2
pint Ctup Lal 502 * Stat. 2
Lpt maxCtup)) # Stat. 3
# Stt. 4
a.tatment /

btatement 2 Shatenerit

5. Consides tu coole giien belou


X=50
defcheck(Y):
mssung ctatcmert
X= Ytx
Ddl

Page

check (30)
point
hhich
CX, )
he statmentt
shsuled be
follouing
thu'slak Mising Shalimuls
e n
he oput pooluct is C64,a
(b)global X50
glotalx
based q6.
(a)Boh ad ka the Kas.

c2A i ue butt Ru Fale


(d2Ais false bt Rü
6. Aist is an imtasle data lype
Ri
K When an attenmt is made to updatt
ypolat rale
the

an ammitable vanialle tha cld nialte s


deatoyed laneus anale ii eattd by the
Same hamen memoy.
(dAs lalse but R is true

Medules.
RiA function in a mslule wees to smply
:b)
Ans Reth AR Rar Apatlsn
t ue bt Rii net dae
coet
nol or A
8. hhat will be the oulpit f He felloutng code:

neuscolar = (do. eplace ('o'4 )


put neuscolo4)
Ans C#l#h helps t# qie shadtt w t# the
pictae.
pa iasting b)5.3t6.3

beles accepti
accepli a numkes
belos as an
Thecooe guien

ndeline el he laum):
cosectns mado

deluie erlumles

em=O
hhileum >0

Petisn_90
punt Hetlunbe Cl234)2

em=O
ushile um>O:

num =num/ lO
pit (anNeunlsen (1234))

Prucct hte oulput ¢ the Python code


gien bolos:
Date
Page

Jext 1= 66 TND 23

I=p
ustile I len CText1):
4 ext1I]= 40'b and
Val =int ( Tox t 1[1
Val =Valt 1

Toxt 2= Toxt 2 tsVal


=<15and Text
Tert 2 =Teat 2+ lTest l
ele
I+=/
pint (Text 2)

AnssD– *3 4

12-Wie the outbut He code


f the
& gien beloo i

daf procuct (p=2, 4=5):


global m
m= p*q ttp

a=20
b-5
pradluct la, b)
pRoluet lq3, p=2)
Ans2O0#12 #

belos - ython code gien.


Date
Page

daf ullence ,
CNI N2):

Pulunn CN1 +N2)


Aetmn lN2+N22
fes ch in range (5,0,-1)3

pint C8lennce A,B))


Ans:eF
eD
cD
cB
LaB

Find and writ the f de pyhon


cetle given belou : outouit

def isplay C sto 2


fo i in Aange lo, len Cst )):

elil (stiCiJ. slowA C)):

elasi

pit Cm)
Piplay (FuRythun 3.70)
AnsNapHONn 3.7.
elaesate
Dale
Pege

15.Reuito the in fython


cole
Aemerng allllowing
&ytox Mndenlieach
Calection dne
Valua = 30 in he codei
defne
#Fiton
(val %4==0):
paint CVAL * 4)
elil vAL%5 =-0):
Part (VAL+3)
E lse
pint (VAL tIo) cale
Display (3o #Functon
Value 30
Value ):

paunt VAL * 4)
elil AL % 5==):
punt (VAL+ 3)
pint (VAL tIo)
Daplay l3o)

You might also like