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

Python Tute 3

This document describes functions for calculating values and counting characters in strings. It defines functions like CalculateArea() which calculates the area of a shape given its radius, and CountLetters() which counts the letters in a string. Examples are provided to demonstrate how to define and call multiline comment functions to perform specific tasks.

Uploaded by

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

Python Tute 3

This document describes functions for calculating values and counting characters in strings. It defines functions like CalculateArea() which calculates the area of a shape given its radius, and CountLetters() which counts the letters in a string. Examples are provided to demonstrate how to define and call multiline comment functions to perform specific tasks.

Uploaded by

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

DaDeuence

Pyhan cotret
eolqen te In bovide
cloubleLimme AtlgAtin
quatesC
Jninthle
ahecific de< Atnng
Returs (nt):
Cint) b- -a es
cuctels
ent Poamet Adds
two
ats HetU
cltbYn acc Ised
inloimation
Use betaeen
The
nombeys ajteH in Tuto-3
Cye BUn
Thhefirst nUmbe
bythan
huUmbet. The
abot
the he DoC
ca c
Cab)
shecitic
Aeeone
nbe cle<inition 4or
multiline he
cen they thecocomenting4 sting
entity
code
tcvo
be furpose,Usage type
striy
thot nmbeS )DacAtrg Onal ancd Poge. Date.
c{0r o
encloAed multilne
multiline
mb
alules,
2Use
Exmle cielinec
Aet Aunctiand allo ehat
ole unctions multiLinetert
camment
cothin
The pantAeult
HadiUA
Calculete =
caculate
Calculate
ae
the oelined
clevelobeHA
(" HetuYn instyVCHons by
On esting
multine
Hea(uacius ne
tailoxecl
he the 1

Vaue excmble seH


dthe anea tunctiony
not
aHeaaroaxcimet to
Valle = delined
o 5 to
thalea
e CYecteilostrate
CiCle Yadius): specifc
)i Yunctions
chcte Tn
usYejult") to theiY
yadiusvalue ) þogamn
with
culate
cahsen task how 9 Poge. Date..
Oun
uJith
vadis you
hese Cqn the
IA

eettess
alel stng
Calculcte
pint
Upbet
(" Countubpe
oueY oind
inhutAtring
Countbþetoaeuinh
cubhetLowe
howe =
the theython
Calcuate
Letters
Atia in
Cey nyrabeu
tunction
e
lette cy
Ceus
e eblpeu that
lettes (sting
CuAe
lo accebt Poge. Dare.

we? i letteA

bbe e
) cn
Ans

be 5 Que-
cli}euent
quHe ccllection In 4
xplainsis Similatly Sobsetexamleseatyect
numbe
stautAtoh Liàt
python SobAtyin tnicling Dese
Psit
Sobstringewrcd s be
Subset
l2,46J cing
.
clat thot a cwithe the
stnngs LO.234, botion
racets instrin)Sob(" beu2.
num
Cinc
types Can
pyhon loYLL 219 In the
Contcçn iA bthon
te c hel
cabbd
flso S, CLLues a
ists :2J
G, allOcus c
1 Cable stAuitable
element wte a
by
Crol te
to youJo
sbecityng Poge Dote.

Can a stxag 9J

cuy

Exanaele
ng tvings(Uniqueit
(int
cniqueiat
t
HeHUYn pintuit)
utspend
"kiwi"
[I] t
pyth
Concatente
Cpvogm 0Y UstCsetCinbeet
on
O
necst
duntian
("
banana
element
wnique
(aiqi ist
gape )
ceth tht
th
idt
aigue
takes
Unique
))

elementd aist
elemen
-de
pintenstecl
Coñcateneted sting
Concct
Sting
Siying Hesult
Heturn
yesulE exomble=
sLsuieSiring! HeBuxn
"ting
elyei
Concoatenctestinga (esulE)int etUYn
2

Atriny)
"wodel""Helo " Helo =
" "tinga
Combaestings

Skvingi CatYl
Coc
oten eyual
Concotencted Atyg):lstingMhng)
cte
Page. Date.

stn

AnsTnpyton. Qup- Ae-8hat


ne, Valye: CLueclelening
||key
assigning byExblatn Hocw
clictiony cy
pesson
mymy he
my cwith 'Olocation'
Lcuhtion'
'city : nam' bsecd hs alue Explain
clo
=value
'key']
dict ict clict
['Keq2] elements
tis mehocls -ConÀicle allo poiy you
clcitetUCtuYe
tht
scLitable
element
(E
ced clictianary
indeAtand
with
oYmotan
DoebeanA
lohn theiy or Tn
addeclLto
a Aitable'
cy exonhle Engineex"
uíWel el}icient
thiAtyuctye in
cenNe
cdded pgthan by
42=
sjeciie key Also a sbaralins
onry
alicti enample cxe
diction atina
cwith tocwsite
eti Page.. Date..

sbecitic ivoves
AtoYEi
cictionary ayy eval' ecci ia c
tewe key
clicttan=
the 9 C
key let
ns
o- e-
PAintclict!
Cciet) Example
ctictionary
cailing
4he bop o
eTheExplain metho
cinel|hesecs
Removes
(key)WauesO
fOPRetxnd a
items(): Ctegyet)' Dictonasty
me4qes item ies
ubolote balate olichion ettiev
Some
the )
cul
(cict Contents method
()' asy Retusnd gieny Remoestemal methocls
keRetuns key
enable
methoct
2
uhalcte daten
wtth aitcy mcthoyinclude
byovicle
el}icent Qncl
(methoc
stable
cll
one in
the
ython
Hetuxn Nasious
tem
acldy
anod
ciltonANy key vclee
Cn mani
clic
iclicticncy
exanmaples value
the yuncticOnall
Poge. Date._

bulticon for
Hon aCLleee
tuhles
ito
2To
pbencl
ue-a
He.e
cletaili t
ust sec4g
aublYay The
JoOmictt oP
ocu)
tem 'o': pint
' 2(removed
C item)
Hemouediem
Ant
3
mycict
?
to popitem( )
terl)pop
oU cbbend tey
olictionaythin
e
an mydit)
Can ualue
ement element
methocl
o
Use
temoues = air
the ms
in 4Yom
clict
nc
ho() the the
Page Date.
etrnsancHe
boþ clic Cinnd
MetuYnA
ist n diAE cwItheh
tem
iBem Honary

exblai THA.
2b Joe-19ite

Hoxnanipulating
len 4on
Pythonists cHiofnsun You thid
Ate
ehd cion4 Cse Intiaize
alist
liat) jUst Con
myistcbbendlL4) the
eist(elem Ahort to
that abhenc the
ent) abhend)
oletculleol
teqessit
note be1,23,4J
myUstwil UAt
RetUns offetCome vaious
Aclcs on pNaVice
methoal!
teth Valiel eXblonat
eHSOUtile
on the coulatbes
sev elemont to
element the
lenqh estal ument. abbenclThe
cpeuoctond be c mentele n
) Page. Dote.

but stingA
elements,
(nunbe
to the
te you
in
Gpop
6Removo(element)-
4-et
Latthe CssecLecl
Sovt_SotA
Rev the YemoeA Citeuable
Extenol
ee)’
inolexRennVe
CSCenoling cnol
ele. oy sheciiedl inolex
eittheen
indlex. teg
yetYNA inciex
,element)
Revese
in
thelALst the
clement& RemaN Abbencla
the itTnse
rcl e
the ts
Teleu
teibt lnalomet eetusn elementd
an Poge Date.

Cat element

the OCCUNE
he em
elements elenent at cin
nce

You might also like