Page 126 - Trackpad_V1_Book 8_Flipbook
P. 126
You will get the following output:
Program 6: To print multiline strings
You will get the following output:
TRAVERSING A STRING
Traversing means visiting each element and processing it as required by the program. We can
access the characters of a string one at a time using indexing.
There are two ways of indexing a list:
∑ Index with positive integers: The index from the left starts with 0.
∑ Index with negative integers: The index from the right starts with -1. The syntax for traversing
a string:
<name of the string> [index]
Program 7: To access different elements of a string
124 Trackpad (Version 1.0)-VIII

