Page 126 - Trackpad_V5_Book 8
P. 126

You will get the following output:













            Program 6: To print multi line 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: Index from left starts with 0.

               Index with negative integers: Index from right starts with -1. Syntax for traversing a string:

              <name of the string> [index]
            Program 7: To access different elements of a string.



















            124   Pro (Ver. 5.0)-VIII
   121   122   123   124   125   126   127   128   129   130   131