Course Content
Basic i/o operations
Object Oriented Programming
0/2
Inheritance
0/1
Modules
0/1
Packages
0/1
Exception Handling
0/1
Python Programming

Python treats String as a character array and identifies each letter in the String with index values. There are two types of indexing, they are positive and negative.
Positive indexing starts with 0 and increments by 1, assigned from left most letter towards right end.
Negative indexing starts with -1 and decrements by 1, assigned from right most letter towards left end.

Accessing String Characters
String characters can be accessed with the help of their indices.

#Example
str=”best”

#accessing with positive index
print(str[1])

#accessing with negative index
print(str[-2])

You cannot copy content of this page