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

Strings in Python - String Manipulation

The document discusses various methods and functions related to strings in Python like indexing, slicing, operators, and string manipulation methods. It provides examples of accessing individual characters in a string and modifying strings using various string methods.

Uploaded by

nithinaravi2004
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)
12 views

Strings in Python - String Manipulation

The document discusses various methods and functions related to strings in Python like indexing, slicing, operators, and string manipulation methods. It provides examples of accessing individual characters in a string and modifying strings using various string methods.

Uploaded by

nithinaravi2004
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/ 17

STRINGS IN PYTHON

INDEX
~ Strings
~ Indexing
~Traversing a string
~ String operators
~ String Slices
~ String functions and methods

Sunge
siqunc characins
Wald chasacuns ncles1d uilhin quelisen l
SPmgsslbu unicodechanaclions
lacamplo "abes,, 6ER","22?2sp
Cach chartactn caw b ndiuidudlyaccissid
elASSMAte
Date
Page

Amda

Snduawg
Feeusano inducing Ond Backwand nduru0
FePndmduinaslonks yuem 0 Dnd badkuwasd
Jndiaing
NOTE=he elemunlk a ing cannet kr changid
05 ungsy a Jmmulable.
Eocample-Mame="Python
s
I 9 45 T Eouand undisum
Mare aLP YTHON
6-5 14 3 KBackuwand undiciub
Wato hew each elkmunt Bmame an bu ascusId2
ameLo]=P-Mamt6]
wams Lr3 4llWsult Mn toz eHon as 3ungs
an ummuiabloand canma loechangd
w
N
n 0
t n d sud te indthe lungh 4a sbue
Junlaama)>6as
Cocample.wbpcl =cenpuln
ueulaHhe slatinmu hund the ngth e suuct
9Wuaoralte the heusand sindumung andbockunod
Jindscing tSubyuct2
ale how each elarment kuettan b dusplayed
|waung beth kpunudung badkuandti unduaing
0 3 3 45 67L K K
sulyudt-CoM P |U |TE R 6k
-8-7 -6 -5
-4 -3 E
namuLo'C -some-81
CIASSMALE

Date
Page

wnamt.-0-Nanel-7
ameL]-M-Nama.l6
name.L31e-Name (-51 wwww.e

nameLeJUnamul-4]
nanL 5]T name-31w
maime6 JE -hamtC21 A
Onama L7 Rham L Aa
clAsSMAte
Date
Page

122020P
uro ariplniiera
Chaxacins desd lhun 8ingh.uets deube quetis

Thuy aeammudable
Aungsane aceusstd Sing Maocl
-9ndkars a ueg ndnges kem0 dolusgth-i
ineuaud diecdien and1,9. ungth an
backisngd deuclien On o

aBAga5ning
taatenhteuglah elenulsei astug,on
ohasaduy_at a tume

hame-pylhen

pintit-end=) EC
EC
egramte wad a skung and dlusplay t un
uxeno PdionlEuedlag onechasactie j une
a-unpul(Enleva ung:"
unt Th shunga,n suasL deuia :
Jangth lenka) 0 e.
lb un Hangg Cungth)-/)xa

ntya ringPYTHON
Th snq PYTHONnHOMbs ols
N
clasSMAate
Dafe
Page

haeanali
tEasicSefpyalerns 6Fug
tond
+>(olenalien

nOConcalpnadlen Ehetalipn
MALA
oCHLalis0 w 3tuggbyoinig uweep0
obiungy
Ra pet>kopet u S

tamplisr DAL SLEIDE


21

193) +abc> 193 abc ALLID


NOTE it ne essuble te cembuneunats
andAPungw epiands n he ame
eLpR6SLen
9dariuy e uakd and ww.aid efpraens
+ 3 > 5 Mald
12 +a > 18a yald
.93 99 alud
9+3-inualud

*oiitenuokS ung n.and.a humber ao a


efohads
i.e, umbndungOK 3ungmAumben A
atsuplucalls ho Pungumbur
e

umasyod
eaomplen 3*g gegogel
Coamplew L
"abc"* 3 obcabcabc
MaNOp AN
clASSMAte
Date
Page

3">nMalhd
6:ba0Membeshyp epusales atsKu
AM and Metun

ap huma Folse o No
Aa n apon>u

198 Met n hlle w


wwwww

Sub =HELP

Pue

Fals
auo Mgt in ung Fals1
ub Met 6ing>1ue

LetnpansleN pnalers ww
Ryhen'slatienal elpHaleAppluTe uegas
well

a=abo>19aeKaaA adaL
AI=a'sTuuededba
"ABC bcFahe
tPenARSuede (ASGID Malue te chuck >k z=,
N
annole.h2o
o g 48-57
'AZ 65-90 b
a- 97-199
CIASSMAAt
Date
Page

'akA>False
QABCS A8> Tue
3 abed'>
ab9Tue

deiurug danal/Aniuedp uoue. pathanacli


0d)-akus a sng thorailn and luemanho
LHpending eudunal unucedo alul

65 www
Achnl-dakus the rdunal ualua.n Aignmo
Muou he cha1alin eerespendung ta hat
Cdinalualu
opntoc:chn Sint>) 2
&somydle-
deul65)

oin 2all
Pat a dung Aelaunung eim Covimgue
chanoclius em h Pung
| lguoat a
ubdkunge Ma olhirng
penld
9t u ilauw thawacknalingailieen ndicvs
hant awd3e= em 01nelRug
aampe
wgd 'amanng
S d L1 ,5 u ulusn mari
elassmate
Date
Page

Eocaxmple
0 3 4 5 6
7 6 -5 4 -9

ed ='annazing
-word.Co:T dk bKonnN AL
mazung

ana
wwend Ca:5]
azi
Ded 7;-31 NE aho
ama
wnd -5:-1
azun

Vaeualierealuin
iagnanno.Llat11
-urll suhrun chaHacinsalung bzhtecn indius slat
upter he Jongila hvbung

-4u ohe characlkns kalkung btuwun indicts 0 and


otep/-
wed. C:61'amayi0 AN
Nd C7 amagvng
Gd C3:]'ang
le-d =amarjio
wod La:1, weid C.31
ing ama
wB-d C1+ wed[3:1
CIASSMALe
Date
Page

QMna+ing
FQumatjuo00
wed + MoeHd-7:
amarrng
'amagg
Siywac-
unanama Llar dlepislip DEDL
epU epienol
Takus euary t elemint kemtho oubslp genunoi
by ladt :3lep n tho ualhu oh vlp)
Caromple:-
w e d =amazing

wped CLL6:01 mn)


ud 7-313] 'a22
4w0d Li Gninana
NOTE SungL: -1 usd Te USLa buwng
S=Hello
puwtlsL51)>&s nh ANLAI
olpunt (GL4JE2 abala

U hugnelheds Aat
lwg eati.nireaL

Capilola0
Racun Cerpy hodbungs 4idh M nst
choradlin copoilaliegd.
clAsSMAte
Date
Page

Aoung>.tapulalige)
hale. cajalalige D
Hlle

Rlinsth uwnbu tecunm the aubslung


lng. ceunt LaubLahit Lslep1aN w
>abhacadabua'.countCob)
obacadabra:.ceutClx1, 9)
obnacadabua.Ceunt ('ab'6)
ww
ndu
Riluensho ndr thoyust eccwsOce efhe
Sukslungem ho ung

ub Funga
sedlsub)

sund Caub,15,99)
>S. ind Loub,15,
25)
19
indcoc.
onwasTe nd but raisEe Valuabve the
ubsbung iMat 4ud R0
obiacadabro' mduoc ob, 6) ASC C

okandabra'.mder (lob),4,8)1nhkd
CIASSIMALe
Date
Page

Valua Foet apaalak

9salnuunt.O au ohoradlven he snng


Rahens Teu Bhes
OHLalpkobilk e4 Numbrss folsu

sbElobol93)
DS> 3hl.bakmum) aL2

Eake

950plha O
Riiuwm we oll chanadlus in he alhung
One alphabilss Folaa dlhuua
Kosg isalpha ()
a l = pbcl93
>>sb=Uhelle
»Lsolpha )
Fake
s t . i8alpha)
»sh3. i3salpha)

96digat h
Raunns Tu a l l chanailens h ug a
dugless Foke 6thuurise
Kstwg.usdugt(O O.asG.u EAa
31=abel93'
n = 12345 alesn
clasSMAte
Date
Page

Fase
s2.isdugt cy
>sh3. isdugit ()
Falke

95leunO
Riiuama u all chanalS/ h o dbung ae
euecasR3 Falsu ehitunse
Kleung>islesen)
>>s1=hlle
>>sth=THREE
5tn 3 Gela
soleuRe)

Fola
s13.leustnO
Fak OEK i d
ssace O
Ratuw Tua hre Pn ukuespaca characlirs
n ho aung3kak emutuse.heoAN
oung 2 JDSpaco

un =
ugluAofpace()
sug. isspaca) NAGEald

Rdurwns iue a l thanaiiy n tho snung a


gpuicasedhaaclo; Folse ehnuske
clAsSM wte
Date
Page

Seung.isuppinl)
Sringl="HÉLLO" 32Pa14
aung="hot n
sng 3-Abe
Aing 4="U193S

sg.isuipl NDbal
Fose
Aing3i6upjait)

leue
erwusls deung te 03wng i.cenlauung enly
Meusecas2
K3ung2 Jeuser )
sungl="HELLO Uh o
sung =h
sug 3="Abc" Awwwww
Aung4"Ul93"
ungl. JeserOi
e
hng 9.Jeuwen)
hne
sing 3. Jeuses) LL K

ul23

upatnO

upocas Aottons
vlwiwgtea bung onaung Bly
alassmate
Date
Page

Seung.uppusl)
2sing l='HELLO LLL Gsdnl

ung 3 "Abc
nng4 "U193" wRlbONnh

'HELLO
eung 2.uppta) L
THEREw
sbung 3.upue
ABC
»Sung4.uppunO

p)-ilurno he dkung ahtn Ameuug he


Meadung ueullsypace uwhliopace em
Sundung he t ende
he shug)
lhingstPupl
5upk)muro hensng aTH MBUng t h i
oailing urhlkspoce ukisfoce 4em h ught nd
he hug)
slung. slupl)
abup)-nlwws ho tug oin umeiung t h
keading and aulung whlieaacus (uwhulispacis grem
tho t_and ghi end ehe olnin9
bing vsnip) E A
onnoles
Sipesipe sujp lane
supe
ipe
Sipe
. alupl)
Sipe
ute
Date
Page

alarisuith0,endsueth.)D ariad
vSlarlsuital)-uduris Ta the Aung
soth

h ubstiwng 3ub Eolks olhatusl


Ksungaanlkueth
ndsudta O-iins Tue L h 3hung erdo th
hubung wb,Fake ethtusl LE

Eaamoles-
>abeddaskusthccd)
abcd shasiouoith.l"'ob62)
Tue
»'abcd"endsucith Ch)
obd endsuiml'cd."2

Riluns te SOBsd slen eung uthene


eachMGed s u g uopts.case Qrd
all Rnaimingthanalin8/ MeuKORA
Saliugg.Jutte) Lu
Cemuilb Suonce

istte
Re Tun h e uq e
ehuanse cased, Fals2
Cemput stunce".ule)
Fol
'Appla 9 Rud"ishulO
1me
Dafe
Page

ploce
Ruhuswsa.euma udth oll ocwruwes ooudbslug
elol aupolocud oy Muw wg
8umg.suplocelold, veu
9ugk hon uyeu.ujhaceCak,n)L
9canL you
yeu ond 9 M8eo yeuyeu,O1D

Teun chanadin o duyg oktun ench mumlan of


he ung.
subslbunajeml<sung>)

E # onlTRIAL)
TEH#R ###LHEEAHHHL
9 ake alenaton a a usto uplo ch seug
hn he guun olinglchanacdin Js yointd t h eodh
Embr ho uat yple
jewa("biol"hele"))
bial $3hlle
join(("Tual",hlle", "Mew"))

lit)
puta a ugbasid gum vobung 0 thanadte
and Ailuuwsa st Corlainingpltseungs Q8
and
wwwwbus
SSung 6pht &sunglthan>
T M Pyhen. alit )
C,Loe'Pythem'
' L e e Ppthon' splt (o")
CIL, 've Pytk, h'
classmate
Date
Page

lastulienO
phsdhaslbu9 ot the 0Cuha
otpunale and ouum/ @ uol coriainung
-atbteru ho atptnaleaa
Aypalo DLdlaaAL9
- Paut olon o vátpLHalor RLA
a t = " 9exyeyserkugg i Pgiher
d.pailulhen (werokun
Cgeyoyuekigg n Python

vwww

You might also like