String indexing & String Slicing |How to use String indexing & slicing

String indexing & String Slicing –string index & slicing “ me kisi name ko index ke sath print karti hai And . python string index ,keval ek character ko print karti hai . jabki ‘python string slicing ‘ kisi length ko target karke print karti hai |

String indexing & String Slicing

Python me in dono ka kuch jyada anter nhi Hai. But Kuch Few Change hai doto me lekin dono ko understand karne ke liye ham sabse pahle String Index ko Samanj te hai And After that String Slicing ko|

Python String index

String indexing & String Slicing |How to use String indexing & slicing
String Indexing python
Python String Indexing video

Python me string index ko understand karne ke liye ham iske liye chota sa program banate hai. Wese str index ka keval itna work hota hai python me ki kisi string me se kisi ek particular ek character ko print karta hai | For Example

Example :

name = "master"                     # string variable

#  string index no

#str positon    =   index  no
# m            =   0
# a            =   1
# s            =   2 
# t            =   3
# e            =   4
# r            =   5

print(name[0])
print(name[1])
print(name[2])
print(name[3])
print(name[4])
print(name[5])

Aap Dekh Sakte Hai ki string indexing me character kis position par hai ussi tarah se aapne isme print karaya jese ki hamne ek variable “name” banaya and usme “initialize” kiya “master” to phir hamne ‘cout’ karke ek , ek character ko alag , alag print karaya hai . and string index & str slicing me [ ] square bracket, use hota hai |

Python String Format | How To use String Formatting Python

String index

Output :

m
a
s
t
e
r

python string slicing

String indexing & String Slicing |How to use String indexing & slicing
String Slicing python
Python String Slicing Video

String Slicing Me Aap Ek Se jyada character print kra Sakte Hai And string slicing me jab ham ek se jyada print karate hai to hame python me ek ‘start argument & stop argument’ dena hota hai . string [ index ] me to keval ek argument dete hai and string slicing ek start and stop argument dono dene hote hai | for example :

Example :-

name = "master"                     # string variable

#  string index no

#str positon    =   index  no
# m            =   0
# a            =   1
# s            =   2 
# t            =   3
# e            =   4
# r            =   5

 # string slicing [start : stop ]

print(name[0:1])    
print(name[1:2])
print(name[2:3])
print(name[3:4])
print(name[4:5])

Output :-

ma
as
st
te
er

String index & Slicing

Aap Dekhte hai dono Example Me Kuch deference hai. issi tarah se string indexing , string slicing ki jati hai |

Dosto mujhe ummed hai ki aap ‘Python String index & slicing’ ko acchi tarah se samanj gye honge agar aap ko ye post acchi lage to mere is website ko jarur follow kre or ha agar aap video bhi dekhna chahte hai to aap mere channel ko bhi subscribe kar sakte hai. channel ka link aapko home page par mil jayega |

Leave a Reply

Your e-mail address will not be published. Required fields are marked *