0% found this document useful (0 votes)
39 views1 page

Python HandsOn-Function&OOPs PDF Computer Programming Software Engineering

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)
39 views1 page

Python HandsOn-Function&OOPs PDF Computer Programming Software Engineering

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

Search

Documents & Teaching Methods & Materials &


' Save
Mathematics

Python HandsOn-
Function&OOPs

Uploaded by Hap Py

( 76% (17) · 12K views · 16 pages


Document Information )
python fresco play
Copyright
© © All Rights Reserved
' Save
Share this document

Facebook Twitter

$
Email

WTQCLI =
Did you find this document useful?

uimtdlis bia L L W s
Is this content inappropriate? Report this Document
(CbiasLi)

Trusted by over 1 million members

Try Scribd FREE for 30 days to access over 125


million titles without ads or interruptions!

Start Free Trial


Cancel Anytime.

]trdik Fjtclas5
ajh strdikfjtcla(pbrb, spjmdb`2, spjmdb`?, `dst2, strhdia)5
# [rdtj ylur mlaj cjrj

wlra2 6 ''
ijwpbrb 6 ''
hlr d di pbrb5
dh d di spjmdb`25
ijwpbrb +6 d
j`sj5
wlra2 +6 d

rwlra? 6 wlra2^5;7V
rwlra? 6 rwlra?^55-2V
prdit(rwlra?)

il]pbmj 6 rwlra?.rjp`bmj(" ", "")


il]pbmj 6 spjmdb`?.eldi(il]pbmj)
prdit(il]pbmj)

h`bk 6 7
hlr jbmc di `dst25
dh jbmc di pbrb5
mlitdiuj
j`sj5
h`bk 6 2
orjbn

dh h`bk5
prdit("Jvjry strdik di {7} wjrj ilt prjsjit".hl
rfbt(`dst2))
j`sj5
prdit("Jvjry strdik di {7} wjrj prjsjit".hlrfbt
(`dst2))

sp`dttja 6 wlra2.sp`dt()
prdit(sp`dttja^5?7V)

bis 6 ^V
hlr jbmc di sp`dttja5
dh sp`dttja.mluit(jbmc) 0 =5
dh jbmc ilt di bis5
bis.bppjia(jbmc)

prdit(bis^-?75V)

prdit(wlra2.rdiajx(strhdia))

Fbkdm Mlistbit Kjijrbtlr5


ajh kjijrbtlr\Fbkdm(i2)5
# [rdtj ylur mlaj cjrj

`st 6 ^V
hlr d di rbikj(=,i2+2)5
F 6 d*(d*d + 2)/?
`st.bppjia(F)

hlr d di rbikj(`ji(`st))5
ydj`a `st^dV

Wrdfj Iufojr Kjijrbtlr5


ajh prdfjkjijrbtlr(iuf, vb`)5
# [rdtj ylur mlaj cjrj
`st 6 ^V
`st2 6 ^V
`st? 6 ^V
laa62
jvji67

hlr d di rbikj(?, iuf+2)5


dh d925
hlr e di rbikj(?,d)5
dh (d % e) 66 75
orjbn>
j`sj5
`st.bppjia(d)

hlr d di rbikj(`ji(`st))5
dh(d % ? 66 7)5
`st2.bppjia(`st^dV)
jvji +6 ?
j`sj5
`st?.bppjia(`st^dV)
laa +6?

dh(vb`)5
hlr d di rbikj(`ji(`st2))5
ydj`a `st2^dV
j`sj5
hlr d di rbikj(`ji(`st?))5
ydj`a `st?^dV

M`bssjs bia Loejmts 25


Qbsn 25
# [rdtj ylur mlaj cjrj
m`bss Flvdj5
ajh \\didt\\(sj`h,ibfj,i,mlst)5
sj`h.ibfj 6 ibfj
sj`h.i 6 i
sj`h.mlst 6 mlst
ajh \\str\\(sj`h)5
rjturi"Flvdj 5 {sj`h.ibfj}PiIufojr lh Qdmnjts 5 {sj`
h.i}PiQltb` Mlst 5 {sj`h.mlst}".hlrfbt(sj`h6sj`h)

Qbsn ?5
#[rdtj ylur mlaj cjrj
m`bss mlfp5
ajh \\didt\\(sj`h, b,o)5
sj`h.b 6 b
sj`h.o 6 o

ajh baa(sj`h,ltcjr)5
prdit("]uf lh tcj twl Mlfp`jx iufojrs 5{}+{}d".hlrfb
t(sj`h.b + ltcjr.b, sj`h.o + ltcjr.o))

ajh suo(sj`h,ltcjr)5
dh(sj`h.o96ltcjr.o)5
prdit("]uotrbmtdli lh tcj twl Mlfp`jx iufojrs 5{
}+{}d".hlrfbt(sj`h.b - ltcjr.b, sj`h.o - ltcjr.o))
j`sj5
prdit("]uotrbmtdli lh tcj twl Mlfp`jx iufojrs 5{
}{}d".hlrfbt(sj`h.b - ltcjr.b, sj`h.o - ltcjr.o))

M`bssjs bia Loejmts ?5


Qbsn 25
#[rdtj ylur mlaj cjrj
m`bss pbrjit5
ajh \\didt\\(sj`h,t)5
sj`h.t 6 t
ajh adsp`by(sj`h)5

prdit("]cbrj lh Wbrjits ds {} Fd``dli.".hlrfbt(rluia((s


j`h.t)/?,?)))

m`bss sli(pbrjit)5
ajh \\didt\\(sj`h, t, sp)5
sj`h.sp 6 sp
pbrjit.\\didt\\(sj`h,t)

ajh sli\adsp`by(sj`h)5
Wjrmjitbkj\hlr\sli 6 (sj`h.t*sj`h.sp)/277
prdit("]cbrj lh ]li ds {} Fd``dli.".hlrfbt(rluia(Wjrmji
tbkj\hlr\sli,?)))
prdit("Qltb` Bssjt [lrtc ds {} Fd``dli.".hlrfbt(rluia(s
j`h.t,?)))

m`bss abukctjr(pbrjit)5
ajh \\didt\\(sj`h, t, ap)5
sj`h.ap 6 ap
pbrjit.\\didt\\(sj`h,t)

ajh abukctjr\adsp`by(sj`h)5
Wjrmjitbkj\hlr\abukctjr 6 ( sj`h.t*sj`h.ap)/277
prdit("]cbrj lh Abukctjr ds {} Fd``dli.".hlrfbt(rluia(W
jrmjitbkj\hlr\abukctjr,?)))
prdit("Qltb` Bssjt [lrtc ds {} Fd``dli.".hlrfbt(rluia(s
j`h.t,?)))

Qbsn ?5
# [rdtj ylur mlaj cjrj
m`bss rjmtbik`j5

ajh adsp`by(sj`h)5
prdit("Qcds ds b _jmtbik`j")

ajh brjb(sj`h, b, o)5


sj`h.b 6 b
sj`h.o 6 o
prdit("Brjb lh _jmtbik`j ds {}".hlrfbt(sj`h.b * sj`h.o))

m`bss squbrj5

ajh adsp`by(sj`h)5
prdit("Qcds ds b ]qubrj")

ajh brjb(sj`h,b)5
sj`h.b 6 b
prdit("Brjb lh squbrj ds {}".hlrfbt(sj`h.b * sj`h.b))

Flau`js 25 Abtj Qdfj


dfplrt abtjtdfj
ajh abtjbiatdfj(vb`,tup)5
# [rdtj ylur mlaj cjrj
` 6 ^V
dh vb` 66 25
m2 6 abtjtdfj.abtj(tup^7V,tup^2V,tup^?V)
`.bppjia(m2)
`.bppjia(m2.strhtdfj("%a")+"/"+m2.strhtdfj("%f")+"/"
+m2.strhtdfj("%T"))

j`dh vb` 66 ?5
m2 6 abtjtdfj.abtj.hrlftdfjstbfp(tup^7V)
`.bppjia(m2)

j`dh vb` 66 =5
m2 6 abtjtdfj.tdfj(tup^7V,tup^2V,tup^?V)
`.bppjia(m2)
`.bppjia(m2.strhtdfj("%D"))

j`dh vb` 66 15
m2 6 abtjtdfj.abtj(tup^7V,tup^2V,tup^?V)
`.bppjia(m2.strhtdfj("%B"))
`.bppjia(m2.strhtdfj("%O"))
`.bppjia(m2.strhtdfj("%e"))

j`dh vb` 66 :5
m2 6 abtjtdfj.abtjtdfj(tup^7V,tup^2V,tup^?V,tup^=V,t
up^1V,tup^:V)
`.bppjia(m2)

rjturi `

Flau`js ?5 Dtjrtll`s
dfplrt dtjrtll`s
dfplrt lpjrbtlr

ajh pjrhlrfDtjrbtlr(tup`jvb`ujs)5
# [rdtj ylur mlaj cjrj
`2 6 ^V
bis 6 ^V

tjfp 6 dtjrtll`s.mym`j(tup`jvb`ujs^7V)

mluit 6 7
hlr d di tjfp5
`2.bppjia(d)
mluit+62
dh mluit 66 15
orjbn
bis.bppjia(tup`j(`2))

bis.bppjia(tup`j(`dst(dtjrtll`s.rjpjbt(tup`jvb`ujs^2V^7V,`j
i(tup`jvb`ujs^2V)))))

tjfp 6 dtjrtll`s.bmmufu`btj(tup`jvb`ujs^ ?V, lpjrbtlr.baa)


bis.bppjia(tup`j(`dst(tjfp)))

tjfp 6 dtjrtll`s.mcbdi(tup`jvb`ujs^7V,tup`jvb`ujs^2V,tup`jv
b`ujs^?V,tup`jvb`ujs^=V)
bis.bppjia(tup`j(`dst(tjfp)))

tjfpHlrQbsn: 6 `dst(dtjrtll`s.mcbdi(tup`jvb`ujs^7V,tup`jvb`
ujs^2V,tup`jvb`ujs^?V,tup`jvb`ujs^=V))

tjfp? 6 dtjrtll`s.hd`tjrhb`sj(`bfoab x5x%?667,tjfpHlrQbsn:)


bis.bppjia(tup`j(`dst(tjfp?)))

rjturi tup`j(bis)

Flau`js =5 Mryptlkrbpcy
hrlf mryptlkrbpcy.hjrijt dfplrt Hjrijt
ajh jimrajmr(njyvb`, tjxtjimr, tjxtajmr)5
# [rdtj ylur mlaj cjrj
fbdi@dst 6 ^V
h 6 Hjrijt(njyvb`)
[email protected](h.jimrypt(tjxtjimr))
a 6 h.ajmrypt(tjxtajmr)
[email protected](a.ajmlaj())

rjturi fbdi@dst

Flau`js 15 Mb`jiabr
dfplrt mb`jiabr
dfplrt abtjtdfj

ajh mcjmn@jbpTjbr(yjbr)5
dh (yjbr % 1) 66 75
dh (yjbr % 277) 66 75
dh (yjbr % 177) 66 75
rjturi 2
j`sj5
rjturi 7
j`sj5
rjturi 2
j`sj5
rjturi 7

ajh usdikmb`jiabr(abtjtup`j)5
yjbr 6 abtjtup`j^7V

`jbp 6 mcjmn@jbpTjbr(yjbr)

dh `jbp 66 25
flitc 6 ?

Trusted by over 1 million members

Try Scribd FREE for 30 days to access over 125


million titles without ads or interruptions!

Start Free Trial


Cancel Anytime.

j`sj5
flitc 6 abtjtup`j^2V

prdit(mb`jiabr.flitc(yjbr,flitc))

#--------------------------------------

f 6 mb`jiabr.flitcmb`jiabr(yjbr, flitc)
fliabys 6 ^wjjn^7V hlr wjjn di f dh wjjn^7V97V
aby 6 fliabys^-2V

`st 6 ^V
FLIQC 6 flitc
TJB_ 6 yjbr

hlr d di rbikj(;)5
a 6 abtjtdfj.abtj(yjbr,flitc,aby)

`st.bppjia(a)

dh (`jbp 66 2) bia (flitc 66 ?)5


dh(aby 66 ?4)5
aby 6 7
dh(flitc 66 2?)5
flitc 6 2
yjbr 6 yjbr + 2
j`sj5
flitc 6 flitc + 2

j`dh (`jbp 66 7) bia (flitc 66 ?)5


dh(aby 66 ?3)5
aby 6 7
dh(flitc 66 2?)5
flitc 6 2
yjbr 6 yjbr + 2
j`sj5
flitc 6 flitc + 2
j`sj5

dh((flitc 66 2) lr (flitc 66 =) lr (flitc 66 :) lr


(flitc 66 ;) lr (flitc 66 3) lr(flitc 66 27) lr
(flitc 66 2?)) bia (aby 66 =2)5

aby 6 7
dh(flitc 66 2?)5
flitc 6 2
yjbr 6 yjbr + 2
j`sj5
flitc 6 flitc + 2

j`dh((flitc 66 1) lr (flitc 66 8) lr (flitc 66 4) lr


(flitc 66 22)) bia (aby 66 =7)5
aby 6 7
dh(flitc 66 2?)5
flitc 6 2
yjbr 6 yjbr + 2
j`sj5
flitc 6 flitc + 2

aby 6 aby + 2

prdit(`st)

#------------------------------------------------------------
----------

b 6 (abtjtdfj.abtjtdfj(TJB_,FLIQC,2))
stbrtdik\aby 6 b.strhtdfj("%B")

abys 6 ^ "Fliaby", "Qujsaby", "[jaijsaby", "Qcursaby", "Hrda


by", "]bturaby", "]uiaby" V
mluit6 ^1 hlr d di rbikj(7,;)V
pls6-2
hlr d di rbikj(7,;)5
dh (stbrtdik\aby 66 abys^dV)5
pls 6 d
orjbn

prdit(abys^plsV)

Flau`js :5 Ml``jmtdlis
dfplrt ml``jmtdlis
ajh ml``jmtdlihuim(tjxt2, admtdlibry2, njy2, vb`2, ajaumt, `
dst2)5
# [rdtj ylur mlaj cjrj
a 6 {}
hlr jbmc di tjxt2.sp`dt()5
dh jbmc di a5
a^jbmcV +6 2
j`sj5
a^jbmcV 6 2
slrt\a 6 admt(slrtja(a.dtjfs(), njy 6 `bfoab nv5nv^7V))
prdit(slrt\a)

mlu 6 ml``jmtdlis.Mluitjr(admtdlibry2)
hlr jbmc di ajaumt5
mlu^jbmcV -6 ajaumt^jbmcV

prdit(admt(mlu))

lraj 6 ml``jmtdlis.LrajrjaAdmt()
hlr d di rbikj(`ji(njy2))5
lraj^njy2^dVV 6 vb`2^dV

aj` lraj^njy2^2VV

lraj^njy2^2VV 6 vb`2^2V

prdit(admt(lraj))

a1 6 {"laa"5^V, "jvji"5^V}
hlr d di `dst25
dh d%?6675
tjfp 6 a1^"jvji"V
tjfp.bppjia(d)
a1^"jvji"V 6 tjfp
j`sj5
tjfp 6 a1^"laa"V

tjfp.bppjia(d)
a1^"laa"V 6 tjfp
dh a1^"jvji"V 66 ^V5
aj` a1^"jvji"V
dh a1^"laa"V 66 ^V5
aj` a1^"laa"V
prdit(a1)

Cbia`dik Jxmjptdlis 25
ajh Cbia`j\Jxm2()5
# [rdtj ylur mlaj cjrj
b 6 dit(diput())
o 6 dit(diput())

dh(b92:7 lr o0277)5
prdit("Diput ditjkjrs vb`uj lut lh rbikj.")>
j`dh(b + o) 9 1775
prdit("Qcjdr suf ds lut lh rbikj")
j`sj5
prdit("B`` di rbikj")

Jxmjptdlis ?5
ajh HL_@llp()5
# [rdtj ylur mlaj cjrj
i 6 dit(diput())
`2 6 ^V
hlr d di rbikj(i)5
`2.bppjia(dit(diput()))

prdit(`2)
dtjr2 6 dtjr(`2)

hlr d di rbikj(`ji(`2))5
prdit(ijxt(dtjr2))

rjturi dtjr2

Cbia`dik Jxmjptdlis =5
ajh Obin\BQF(ob`bimj,mcldmj,bfluit)5
# [rdtj ylur mlaj cjrj
h`bk 6 7
dh ob`bimj 0 :775
prdit("Bs pjr tcj Fdidfuf Ob`bimj Wl`dmy, Ob`bimj fu
st oj bt `jbst :77")
j`sj5
dh(mcldmj 66 2)5
dh bfluit 0 ?7775
prdit("Qcj Fdidfuf bfluit lh Ajplsdt sclu`a
oj ?777.")
j`sj5
h`bk 6 2
ob`bimj +6 bfluit
dh(mcldmj 66 ?)5
dh(ob`bimj - bfluit)0:775
prdit("Tlu mbiilt wdtcarbw tcds bfluit auj t
l Fdidfuf Ob`bimj Wl`dmy")

j`sj5
h`bk 6 2
ob`bimj -6 bfluit

dh(h`bk)5
prdit("Zpabtja Ob`bimj Bfluit5 {}".hlrfbt(ob`bimj))

Cbia`dik Jxmjptdlis 15
ajh @dorbry(fjfojrhjj,distb``fjit,olln)5
# [rdtj ylur mlaj cjrj
dh(distb``fjit 9 =)5
prdit("Fbxdfuf Wjrfdttja Iufojr lh Distb``fjits ds =" )

j`sj5
dh (distb``fjit 66 7)5
prdit("Iufojr lh Distb``fjits mbiilt oj Ujrl." )
j`sj5
prdit("Bfluit pjr Distb``fjit ds {}".hlrfbt(fjfojr
hjj/distb``fjit))

@dstLhOllns 6 ^"pcd`lslpcjrs stlij","mcbfojr lh sjm


rjts", "prdslijr lh bznbobi", "klo`jt lh hdrj", "lrajr lh pclji
dx", "cb`h o`lla prdmj", "ajbtc`y cb``lws 2", "ajbtc`y cb``lws
?"V

olln 6 olln.`lwjr()
dh olln di @dstLhOllns5
prdit("Dt ds bvbd`bo`j di tcds sjmtdli")
j`sj5
prdit("Il sumc olln jxdsts di tcds sjmtdli" )

Share this document


! " # $ %

You might also like

The Subtle Art of Not Giving


a F*ck: A Counterintuitive
Approach to Living a Goo…
Mark
Life Manson

API Gateways
Anuj Kumar Singh

Shoe Dog: A Memoir by the


Creator of Nike
Phil Knight

Magazines Podcasts

Sheet Music

Intellectual Property Quiz


Sean Sean

Never Split the DiKerence:


Negotiating As If Your Life
Depended On It
Chris Voss

GIT Handson
jayaprakash

Computer Programming

SoNware Engineering

Computer Science Computing

Yes Please
Amy Poehler

RPA.docx
Mary Urrea

Devil in the Grove:


Thurgood Marshall, the
Groveland Boys, and the…
Gilbert
Dawn of King
a New America

Convolutional Neural
Networks (CNN)_QA &
HandsOn
जोशी अंिकत

The Hard Thing About Hard


Things: Building a Business
When There Are No Easy…
Ben Horowitz
Answers

Python 3 - Functions and


OOPs.rtf
Ayush Garg

Show more

About Support

About Scribd Help / FAQ

Press Accessibility

Our blog Purchase help

Join our team! AdChoices

Contact us Publishers

Invite friends
Social
GiIs

Scribd for enterprise Instagram

Twitter
Legal
Facebook

Terms Pinterest

Privacy

Copyright

Cookie Preferences

Get our free apps

Books • Audiobooks • Magazines • Podcasts •

Sheet Music • Documents • Snapshots • Directory

Language: English

Copyright © 2021 Scribd Inc.

What is Scribd? *

Millions of titles at your fingertips


Home Only ₹299/month.
Books Cancel anytime.
Audiobooks Documents

You might also like