0% found this document useful (0 votes)
53 views2 pages

X "Vijayagiri Public School"

The document discusses string slicing in Python. It defines a string "VIJAYAGIRI PUBLIC SCHOOL" and demonstrates different ways to slice it, including forward slicing from start to end indexes with optional step values, backward slicing from end to start indexes, and examples of slicing syntax with indexes.

Uploaded by

VijayaBabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views2 pages

X "Vijayagiri Public School"

The document discusses string slicing in Python. It defines a string "VIJAYAGIRI PUBLIC SCHOOL" and demonstrates different ways to slice it, including forward slicing from start to end indexes with optional step values, backward slicing from end to start indexes, and examples of slicing syntax with indexes.

Uploaded by

VijayaBabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

V I J A Y A G I R I P U B L I C S C H O O L
-24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1

X=”VIJAYAGIRI PUBLIC SCHOOL”


X[0] X[-1] X[-20] X[-15] X[23]
X[STARTINDEX:ENDINDEX:STEPVALUE]
ASCENDING ORDER SLICING (FORWARD SLICING)
X[0:7] X[7:14] X[0:9:2] X[: 19:3] X[-10:-2] X[::2] X[::3] X[10:] X[10::2]
DESENDING ORDER SLICING(BACKWARD SLICING)
X[-1:-9:-1] X[22:2:-1] X[-5:-24:-2] X[::-3] X[:-23:-1] X[::-1]
0 1 2 3 4 5 6 7 8 9
V I J A Y A G I R I
-10 -9 -8 -7 -6 -5 -4 -3 -2 -1
------- --------------
x[:-1] x[:-1:2] x[ : -1 :2] -1-1
x[-9:]
x[-7:-2] -7 -6 -5 -4 -3 endingindex-1 -2-1
x[2:9:2] “jygr”
x[2:] “jayagiri”
x[0:6] “Vijaya”
X[0:7] endingindex-1 “vijayag”

You might also like