Page 150 - Plus_V2.2_C8_Flipbook
P. 150

Program 3: To print special symbols using escape sequences.












                  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 4: To access different elements of a string.










                  You will get the following output:




















                  148   Premium Edition-VIII
   145   146   147   148   149   150   151   152   153   154   155