0% found this document useful (0 votes)
15 views

Python QB Mse

Uploaded by

rishiveer987
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Python QB Mse

Uploaded by

rishiveer987
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

clAsSMAte

Date
PP QBMSE

whaiae canses Boiecs ? Hawone theyoealed?


: canoin alenhund onNealingahjtosrauiding a
laauda
ta deline the behaiau &shuctuea tte
Labict t gerus an templaten tha) deline, apeftea
Catabutea) &acian (method hatajedo al that
dan canhane &er7oum,naonetvely
Cans
attibudeo mothoda
Atribude: uaablen that halddataaooiated uith
clarsoainatanes Thaytedeinod within the clam
&ane aensed uoing dat ratatian
>Mehoda huntano de7ined uwithin acdaa thatcan
anoate onth atribulus &
nenhaMAnuhicactan
ldayech alyeco aze hatanes a, claasi Clas in a
Logualcanarut.aypea anephysical Mealihy
Nunenaa slhieca can be teated tom aingolas.
yecs ae lasie Tuntme enttieo witthaneciic
chanaterusica &behauiaun

dyntax bon clases:


dans < Clano Nayme>:
#atherCode
John Name:
StudondIL
slhdiaplay)
s]:names'Jahn'
dtudentc) Sl=
I)tudeni ('n nunt
nalna) (Rolna'
self-age) aell ('Ag print
print
4elliname) (amea' punt
dianlay(ael)i day
student: egda
Cpatamate) Nanes <Cas
<Onamee
te Datg
clAssMate
Date/

(Evpláun in brielbar Smshs a)


ALExplan unes a Tnhertane with examnleg
Tabeitane is delinedan the mechariam o
Inhoiting pnanerieoa bose cdang ta thechidea
tynea,intoritanee caenda an noa chüld &oc
paruntclangen inualved
ilAingle Tnheutane
Aingle inheritaeerakles a dorused clana lo inherit
paperties ama ainglepauntcan.
enades csde neusabty &additan a< new beatuzea ka
Ciating cade
A

ey
dans Patant i
de bunellaell)
print ("un 1")
clans Chwd CPoern):
dey buneCol): a

Child C)
abË Hune c)
classmte
Date

iiutinle Tnhoruháne
Whena cdaa can edotued am mane than one
basech, this tunhe al inheitane is caled mun
nheritanes
a eatuLeA theose clases ae inhanited ndo
the doiwed dano

dan B1:
name1=||):
de< hune1loel)i
printlolname 1)
cdansBO
dah un Cael)
ntCael name2)u
dans Deriwed ( B1,81):
dal paenb Lael
pnt ("B1:eellinamet)
prunt ("B0:el name)
sebaneis) Qrisy rint(
nuntName'yoe:name
dàplayinyaloet): -d
aneùs=aneies
ia sell:
linamesareies) name Dename= i
Aniumal: dano
A
and7athen chi&
ld blw ton aimilata
ala
Lcleriwecdang
te huted
to &thedueddan
then axe
an base the oatwe jnheritanee mulhlouel In
nhitane hMultileuel
paendo
C) dl
BaseI d:name1
5"
De)ved
() dl=
Ate Date/
cdassMate
Date

das Dog CAnamal)


delincelhameaneiebi Loreed)i
QunonU.intCnamesAnois)
Aunen(duplay-inga)
int ('Breedseibreee)
cansda RunyCog
iniCoelsname ayneciessAnosl. age)
Aunen()initCnamesoneies desd)
sell agege
dy diapa-into Caell)
Aen)diaplayinto0
print C'Ag'soag
Puppy a Hinpy ("Buday, Canine, "galden Retieui
hunnydiaplay inyaC).
iv ieranchial Tnheutance
when more thanane deriued dans ate Uated
a ainglebase, thia kynea inhenitance ia called bram
hienaichial ynheritance
classate
Date

danoPastont:
da bune1 Ceell)
int ("buntanin pauntclana)
Ldam Chld1( Panort)
del hunen Caell):
rint("huneiani in chid I)
dass Child_cPaon)
de, bune3 Coely)
prunt (yunian is n child T")
LaytChild1 ()
Chuld20

olii unc20
aiun 1c)
elassMate
Date

Hykid Tnheriane
Tnheraane canåuing af mutple fynn a
nheitanne jb calledhyid nheitane
dars F can

clansE

danac

dam Aehaal
del une 1Coell)
nrunt (" ths huncian is in haal)
clans Akudentibehaal)

clas
iunt (Ihis hunian u on atdan 4")
udendg Adt behaal):
del bune.(sell):
clas tudant3_CAHdend 1,eha):

hject =ltudorts cO
alyject bun10)
daliniCaellab)
conatructn#poramteised
de<-initCoel)
conattuton dabaut #
the nmaulded
y aJumenb
are afest
he aely) (Raun ascontrutedl being inatanee
TreberanNe
linatagumentao
the to takulto A
anapaTAmeteised knaun
as panametoro
ja
canatrta
with canatructan panameterused
ngnthichataerene
inatane to conatrded. ane
ebinitian
ha0 argumenTa
lecanatntan
which debautcanatrutooi auartan doeard
onatructano yneoa
canatucton #Aodya
delint
ayntax
reated aljtio aliaycaled
an
when
ed alyetthe
cansis when
anthedars
oinitialise takcanatruto u
s
GenonayAec
7an Conatrucos
ae siyect an
anatrutasExplain ynesa whaiare
MAte Dale.
slDate/ssmate
Qhad'o methad auwrdsoding &mathad auenidin
oMethod Ouendaadng
alaus dering mitinle mthod ihoame
ut dientpaamatea anbehauiaua based
án T/ppaametes

dob neduct casb):


print cp)
de odut Casb)
paa*b*c
nrini (p)
method Olwenniding
when childclans hað akunian with ameat
name ao uncian in parontcdaas uneian
in parent dans aet, auurnidelen &eid clan'
bns gela e|eeutedsio
dans A : i V N
LdelnnCal)
shnint:(3A)
dans BCA):
classHate
Date

Cadd mae theay dt enda tAeeia)


Qhatane uanedico ay dicianay kayouA

moe than ane enbu nerkOy art alawedhen


multrle duplicate keys anienaurdeed slant
anoignmend wns.
Immutablty
Rya muat immutale
an Aealingo i u e uounles ut cart UAe
we

Case denaitie
dictianaykeys are casebenatue
same nami hyg ut with cihant cases aneteated

Q Whati ding ? Explain any Smathodorieode characa


Abung in puthan is aAeauence a
enclasdin angle,daublesan unle qualea
capitalize C) Lcanienh bnatchanatn ay the atng
ex:
Stre' rai!
capitalize( )
printCstr # Rait

Casetldco conerdo abing to Lauencoee


Stre'RAIT'
prùnt CStt. casefoldC)) * rait
alAssMAte
Date

caunt Caulating):ukno thene ay ines anecili


Auhairing aaLTOin the aing
Str= RAIT'
int Cstr. countR) #1

stre rait!

abrip (): lemauea any Leading &traling spaces


stre Hello World
print Cstrastrip()#Hella WorldL
na uit anaos at
Atto1end
alAssMAte
Date

thas ane beahuuo aoy Pythan


PythanwAan dißerent plat7aumaCwindaus uN0Y,
RaaneryPDdneta ia partability åcampatibility sallauing
demaeaita uwrat code that an be eaaly un
Iauau 0s wlo modyicatan.
Puthan ha amnle aynhau aiman le inglah languaye
nakina teaay to learn &read. This simpiats enhanus
eadaiky a cade& Mecees cOAt ay progriam main tain.
-ene
Puthanalaiyntax allauskan daulareno ta wite progiama
with bewelra thansamesthenBgzAmung languages.
desding lo inuased paductivity tostendslarnart
ayles
Pythansung an inenFnakr ayalamsenalling cade to le
eeasted ao asan as it is uutin Thiaeatue kaaitalea
quiceyatatyning,tuating &dabugging uihich e
benegeial fan RAD
Puthan can be treated ina prscedwnd wny,an
alject ariented ay an tunctianalayprouiding
deualanp with the eibility ko chaase Hhemaat
auitallepnognamming patadigm bathein kpeiie
anph eaiemanto
connue
CI,) Tange n ikan
eyi
niuen
programeLHan
ith teminated& iteratian hext
iatey teatan
loapuunt
io he
deanteud atatemand hencantinue
itenaHan nt to an
imawe otoap tahan autUOnt akip toUsee
ConHnue
Ci
int
break
i5
tange
a7torth atatement et wicaninueo
th eeutian
on¢unaded inmedintely aloapdaapa
nacle
eneantered otadement
io eak when
nemgtuwly
tminatealoap to
usedl
Break
iana Aatemen,
to
Uaed
law nol ae
AreakCAninue
pans &
each ewample
af Autadle
atumand
with Aoneak,catine
&pang iplain
ate Date
clAsSMAte
Date_

44

Pao
usedao nlaahalde uhen aatatement is eaixed
aynaHcalysautna cade naedo tobe eented
&osi in hange (1)
pana
eloei
unti)

QExplain talauing aneatmno witth pythan with


Atadleexamnl
C nat in

o aneraton checko dun Unualles naunt to the


pame oljet in memany Retuns tr tue if aniables
ane the eameajet False ahenuise
PTO
classmate
DateLL

b=a
unt caish) # 0]p True

b in anetatanchecen aalue eiata within a


Aeaene thatwhno True il iais taund

azll23]
uint Cvin Lia)
not n aneatonhecka i a ralue daesteut
withun a Aequne Retun True l ae arid
bound &Falae'y kaund

4 not'n ai
unt 4 natin làt
elassmate
Date_

odtanas: caeian a key -uclepais wheze each


Rys ansocàted withaaneiyi vaue
o kaug muat le uniue dimmutalemeanng they cannat
-behangcd. ane aignecl
ualus canbe a any data tyne
mydud key iyalne',ky'ale)
clasSMate
Date

O|P Quanians.
sl: 'rat Qengineninq cam

X2" "):ut

eint Cs2,end ")2


4int(s)
o)P: aienineein
P
dano A:

int ("hat o Acalled)


lcdaro BCA):
-day
dtteatCaal)
punt('aat af Bcalled")
Qun)-hat
daas CCA):
deh hat coell):
pint "at a ccalled")

dans DCBsc)
dey keot Loell)
int ukeat ay Dcalled")
clAsSMAte
Date_

kest al Bcalled
last a) Ccalled
kost a A Acaled
KRRORNçernan auuaslase cla teat method ie
aideray
AO

tup-(10,30 15,a)
S=l
t=0

4atttupLil
prunt( ":"t)
pint (t
O:
|:30
130
dhs Mate
Date

312s4
354

das Bose Caljt)


pans
cans qerixd CBa4e):
pans
nunt Cib aubelasCBase, we)
d= Deued
nint Co natam Chifeiued)
int b in tance CdBag)

Falae
Falae

inAclaso Cautclamtolsedheckodiparuntda)
Trus Aubdas a paJent cans
iintane CslyedNaMe, lana Nlano)

You might also like