Indexing
Python Tutorial
by Menard Maranan
“Indexing”
XIndexing
What is index?
>>>Index in Python refers to
the position of an “Iterable”.
>>>Index position starts from
the position ZERO ‘0’
“Indexing”
XIndexing
EXAMPLE:
Let’s take this string: “Hello”
>>>Index Positioning works like:
“|H|e|l|l|o|”
“Indexing”
XIndexing
EXAMPLE:
“|H|e|l|l|o|”
>>>The slices represents an
index position, and it starts
from Index Position ZERO
“Indexing”
XIndexing
EXAMPLE:
“|H|e|l|l|o|”
>>>You can call an Index
Position and get the value it
holds using Square Brackets []
“Indexing”
XIndexing
EXAMPLE:
“|H|e|l|l|o|”
>>>To call the letter “e”, just
refer to the index position 1,
since indexing starts from ZERO
“Indexing”
XIndexing
EXAMPLE:
message = “|H|e|l|l|o|”
>>>That’s why you can print the
“e” by typing: print(message[1])
“Indexing”
XIndexing
LET’S
TRY IT
!!!
🐍 🐍

Python indexing (menard maranan)