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

Python HandsOn-Function&OOPs PDF Computer Programming Software Engineering

This document provides Python code examples focused on functions and object-oriented programming (OOP). It includes various code snippets and explanations for different programming concepts. The content is designed to enhance understanding of Python programming through hands-on practice.

Uploaded by

shahdhruvnimish
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)
42 views1 page

Python HandsOn-Function&OOPs PDF Computer Programming Software Engineering

This document provides Python code examples focused on functions and object-oriented programming (OOP). It includes various code snippets and explanations for different programming concepts. The content is designed to enhance understanding of Python programming through hands-on practice.

Uploaded by

shahdhruvnimish
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

77% (93) · 114K views · 16 pages

Python HandsOn-
Function&OOPs

Uploaded by Hap Py

AI-enhanced description

Document Information
This document contains Python code examples relat…

Download

Download as pdf or txt

WTQCLI =

(CbiasLi)

]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

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 ?

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")

Read this document in other languages


Bahasa Indonesia Deutsch Português Română

Share this document

You might also like


PDF 100% (1)
Python Hands On

11 pages

PDF 100% (3)


Ap Computer Science Principles Practice
Exam and Notes 2021

108 pages

PDF No ratings yet


Modules 1

9 pages

PDF No ratings yet


Python 3 Function and OOPs Handson

11 pages

From Everand
Inverse Trigonometric Functions
(Trigonometry) Mathematics Question…
Bank
Mohmmad Khaja Shareef

No ratings yet

PDF No ratings yet


Python Final Lab 2019

35 pages

PDF No ratings yet


Cooperative Linux

13 pages

From Everand
Profound Python Data Science
Onder Teker

No ratings yet

PDF 100% (2)


Chapter 9

13 pages

PDF 100% (1)


Gigabyte H310M S2V 2.0 Rev 1.0
Schematic

50 pages

PDF No ratings yet


Python Hands On Answers

15 pages

PDF No ratings yet


Python Oops

10 pages

Show more

Documents 
Teaching Methods & Materials  Mathematics

About Support

About Scribd, Inc. Help / FAQ

Everand: Ebooks & Accessibility


Audiobooks
Purchase help
SlideShare
AdChoices
Join our team!

Contact us Social

Instagram
Legal
Facebook
Terms
Pinterest
Privacy

Copyright

Cookie Preferences

Do not sell or share my


personal information

Get our free apps

Documents

Language: English

Copyright © 2025 Scribd Inc.


Download

Related titles

You might also like