33
CHAPTER:5
STRIAO I PTHO
Ttroduchion
Dmiienbaauanns orafirs zrlsd in ~cfa,
deulda trio uatia mgsza
o12 amatal in p}hen~maarète
wwdrangaita A| ta sarna mamsg addrka i
nausalua
ach caeradten kozis ind canaaccesid
una indo
ench lecohon Lo2, n tusord dirachon
nd-1,-2,-3, in ha adkusorA disushion)
yopIa
k a
ha indaz stninanewend diasion kas
e 0amd Sunbackusasuddiuuchen ~antea-
haking Bina is ttalrumbea hasado
ncharactia
in toasáng h a n a t i n d a i a Twardolinecion
Looid J e n-1_andlost indainbackumd
doacdion oLdd e n ) .
Aoina e nadachharadtin in contigusus
ecahon
sSt ohn's Public School
T h e hocade sprunant ne uppotod
AkenqJsecaa
Example
Strkandiugo
# k i n a l i d ndiidnak E l agicante
ne aeued inphc
T
ONbing oBing
elomasds d n a , ena chanonbn ot
Stx=compudn
inda= o
shr kandap Lohiaindas <lan
tor chin Sbr 1 prdrd ShCinda),ond=
prirtCh;end = ) indans LndeL + 1
Oudpu
om pu t e r
kendriq
xinOpeatoa
.Menbethip Opesatena in,nat in)
c.Cegppasuie Opcotes (==lz, <, <=, >, >=)
Á.Poi Dpanteru h aa uwe basic poaina o ig
1) xina oncoanaion Opeudtn)
Li)ana eptikion Oparte (4)
T. ring conatanah on OpetaterTha t openain Caalb
edn ining ha tum opaans zing
Exampa:
Hllo+Pulton
AlPhon
SJPSSt.John's Public
School
35
21
Phen "+3.o
thon3.o
Note You comnd Concato uwmbers amd stana a2
openands_ T h + oporouasa
xampa:
>>1 + 4 unbuppocted opeand sp4) +int'asad ktv
St' inwalld ama Coneaos_aM e0e
iiing Rapetatien Opaste : St is alo kncun
&ira Rapcotilem opatsIyeauinas ue dyps
Operonadd-a tinga amdan ikog.cs ALumb0
Exampla
2*k
ulyeu
Notei You couanst dhonse Aans
u #Canl nmutiply pnce bnsnito tr
Omg 0oKos OaeLE
Memberhip Openatas
in-Rot as krue a hatadm atlgtrag eai n de
gAN dnaoausise FolAe
hat in-Rt Trua i ochasacm_ a uIstnA does
nst eist
Examnp o
Kan inKedlclya Vidhalaya
False
SJP
"Ke endsinaVidnalasp
St.John's Public School
TruLe
vinkandrige alap
8165 nestin 1816543
False
smpanindon Operteu hase opestu cempcsa e
CnoacR chaoctaaccedtha o tAa
ASCTI valua
Chosactus ASCIT (Ordinal vaue
A8 e 51
5 Jts Ao
91te l22
Exaump.la:
»alc> abeD
Fale
ABC abc
kue
abe.d' a D
Tue
BcD <= aLCa
rue
65S.i operate uith ing3
he Alice opezotes 29ice a zouiung ukna a man
indica.
to
Atingnaume tasst iend]
whsra sat omd end ate tage na indices Jt
iisr
om ndes a n t t e nd - L
SJPS St. John's Public School
31
456 8 a 1o 123
datla
u-3=12 1o--R-1 -6 -54 3 -2
Exoumels:
8tY=data gtructuoe"
lo :14]
dado zuctusua
srLo:6]
doda s
13-6
ota kt
7At-5:-
Ratuans empStina
kta[u4d #Misvn4 indax e a ckem a cenhdared aao.
dloda atsuuctusa Cnhdair
Ato o:J #sing inday celon s Cosdanedod
dad ructuse
blL:1
Yuuee
r x 4i] t mad bramgindax strLntsrn:]natomd eigoal shing
dhda tructua
uciesdata at
a t 1, ats]
C k o e data dtr
Blice operats)_uruth p index
aue thied nder.LJhic.
i c e op.erte uoith dngsma
a satapUE s ophonal
L noLun
SJPSSt. John's Public School
hing-nama Lant And Atop
Example
> dcta Arruckuou
L2:1: 2
b. L-11: -3:3]
stAL ::-1] #revegesa ing-
erutunts otad
Ltaraina actLodur eud e bouunds couas en
L i dngs but sDiing a king oudaicla ske indaxd
Example
Lndey Exroy ang inds out ot raae.
K L4:2 #bosh idisos asu outaieledKa bounds.
#ratuuns mpd
stLo16
una
AcLAin a paticulae chanadon a ina
khnRa ndax m Je vald eut e bond
cnaunakis te ututunoa thaoun ndal
Eut l i i g aluuoapatisuas a bsting e
Empuyging hich is va0l eqanc
wnte progann t ind whaath
he on dng polindhm net
SJPSStJohn's Publi School
39
t input E nta a kina
Cre L:-1]):
pint CIt isa palimaluema")
prit Not Palndocoma ")
Wat e progom t coumt he nuuwmbeA e
chanactiu in thegiuen tring nthoud ungda
S l t n unchon
inpt C Entes gouAirg
hab= 0
oriin r
ans+=1
prtLEbana)
Couat check ushaodon thegivan Krinau
painolLona not unth Auuv
Qinput("atsing")
palindrema =st) J a
ind-1
L e i in a:
palidoeme [ind1=all
ind - F 1
palindreme==a:
pit (oat a palindeuema'
p i n t C a + i a nst a paindrema
PSSt. John's Public School
BulltIn Funghiend
len)_Retueund dha Ionsth of ha giM An
ExaumpQe
lanCAL)
5
name =Maia
ORnnana)
2 tle) Rakwws Ja ativna with
n dt eang D latna e o
E uppCae md
Exanmpl
7_r1.titte O
Hell worA
Leuoar ) : Ratuns a
gina Luith all uppa Cae
Dttb Conmlrted de
Exompla exweCare
r1 =halle WoRLD!
hallo oexdd 1
4uppen O Rotouns tha ina
conoted da ppei a uith all lewencak
Jaton
Exaomple
2s1halla WoRLD
i.uppen)
HELLO uORLD
5 r , 3iaod,and)
SJPSSt.John's Public School
41
E xaumpla
>> str1 ="Helle World
Hl Hee
>>st1, CoLunt (Helle, ilL, 25)
2
s1.cowt(Hele)
6Andr aat,and):Ratuenb dke ndax yalue a
oCuten eha Bultring a given &ia Frampla
r 1="CoapLtn Ppmlicaica omputin bianca
1 . findConmputon "
r 1.findscienea "
3
1ind Conmeutn j15,4o)
21
> Ker 1.coutComputan
Ktr 1.Coct Compudun15,Ho)
2
Snind uncKan u tdna d o e n t matA tedha
indel, atast, end)
daxonctiom ol plag tie amaa tale a ind unchom,
bu h ulitin d o a t mat ches wth tha lnesn
Sing fnsws am etue
Exomp:
tr 1 =' Hele Worl Hellg
Helle
r 4 .inder( Hello )
PsSt. John's Public School
atoa.indax(Au')
NoleEnae: Subbdina dtund
nd t outaut h a luingi&r= nfsrmaon.
Oukput nemadien
-1
Otput:
Gs-i-1
OurptYmatio.
Ouput natamme
C7:-1:-11
Oup
via-5:-101-
Outpt amrof
vid stc-1-1O:-2
OLpu niad
find dke ouput he lelleuuna uhu
eraJaa Construcaa
345 6 1 Lo 11231
A A O s r
651-13-2-0-9-8-1 5i 3-2
Owkaut va co
SJPSSt.John's Public School
43
toe-- 5
Opuk
G)Ak 1 Ls:-1]
Odaut Owa ConsetJossaConst
( 4l-12:-1:-11
Oulpuk:ndic bneK
(viAE:51
Ourputrokausnol a
Oupd Jara onabructor
viatL-1
ukautcteuetsns a
Cix)au 9:23 akra:-
Owaurddnlaa
x A o 1 2 14:223
ulputV oSNC
t1l-4:-
upuva Eomuc
xi) Ab [-3:io]
uhpur
SJPSSt.John'sPublic School
8 Endswithubatvin) Jt Rdwmd ou
haows
tiusg endlb ith ha uppRies &uluina stfu
Jt autusms
Exampla
YA Helle Woxld
x1nd CHelle)
alke
sbendauithC!!!)
rue
antowithCacuD-ating): S Ratuw bue i dhe aun
rin
ktosts oith ta eppliad ulsLing etailt tatusuna aly
Examapl
Atr 1 tedlo Vdovld
Bor1. kanta urt
False
1oialnum):S taa gie borin iihuraQhalets
amd thoa otleogt ene
ccacta etharisittwma ale, tke
Sp am pedal charnodin e kpae id
pat o h e
a
imaik stuwmb Aale Exaumpla
sr1tn Helle uoald 1
br1. Jaalnum)
fale
b.itaDnum ()
sb3="tilDworld
rs.alnum)
sJPSSt.John's Public School
1.laen)1tbuutw us JBa e n i n g ku
wRhcase chanadis thanse tateumbale. Exanpla:
sstr He00 wodd I!
sb.ilewer ()
False
sba="ha028uod zo22
Atr2ialswe ()
tn 312345
False
2uppe):
T
Tt ratuuwe duu i alls akarados au in
Ppeak Exomaple:
Isn1Hettsusasuld !I!
b1.ibuppel)
t 2HELLO
n 2uppe)
Tsus
s12=HELLOg1234
tn3 uppe)
e 345
tnippe)
False
b5-HELOJ!!
dnSsuppen()
uA
1gispoAC):3t stum ouu i tdng ia nan empdt
ama a l dhaador hat Sas ohitu hpacas, Llank, nakine.
ExaPLE
SIPSSt.John's Public School
b.iapace)
In\t
o2kpace )
b tpaca)
FaAse
amdlinst atdan el ene wasd
AelNe Warld PpaueoeExsetPLE,
Atiatite.()
So2hQ@le wWos0d
s2jatitlo)
Fae
15.CapitaLinge):
Examp
1=halausoml
.captraline )
Hlloayrad
saite()
HR World
O Abstsip :
Radtuans dk ina oton
Sums
Exammpa
Hello woxdd"
SJPSSt. John's Public School
41
edHells solA
17 t i p OLonida
Reted ho i n g a u emdmgr thu
Waodlun paces 9n dhaioht of dka hivg Exompla
He0B Bld
en1 t i p )
Hells osesrld
18 r p ) : RauR4 dha e e e m Amng a t o a
pacs bod a opt onod plot fdack ha
Xtang Exammp la1
tni= Hee 0o
1 dt ap
Helle s0sAd
19 p a r e Coldt, neus): 9k oplaco Jha cccumca
eold king uuth dha naU Mng. Example:
ex=He00s uDaLoHe0s
t n1 2aplace CHll "H)
s 2 Hall WsNd
A31 2. 9oplore , #
ein ) 3 t sutuuns a toina jm obich ha hsuacteea
oinein ed Rpaadte Exompla
zri='Helo oxIA
At 2 - epos-ats
sn2nCs2)
K e -R- - e-- W - 6 - Y -- d
21 2ptO: St 3anounsa e l usonds dalinmitad by A
zacifac & ina no
uatsing pecikad thá uoordicke
2pconadtad Jay 3poce n d it utumd tRe cudpud in
SJPSSt John's Public School
dAa u n slixt. Exaumala
Abu.sptU
aL'He0, ld Hi Hwasu
aty 2 odia s my Hah'on
tox2 spit (a)
Lndi m he'
22 panhtien):dt sutisuns JA ien XT pasd ened n b
1 eeu pasate.
aepas-ote t
3)AulAina aa apasato
Exomnel:
Ha0DsarAd H uocld He0le
An1poatitiem usod")
Adlo sorio Hisordd Helle