Page 1 - Lesson Note - STRINGS
P. 1

Lesson Note


                                                       STRING


               String in Python is a sequence of UNICODE characters, it can be one or more than one character.
               Character can be a letter (of any language across the world), number or any special character
               (e.g. ?, #, %, @, &, ^ etc)

               Some valid strings are:
               Ex. "abcd", '1234', "A$B$", "????", "1%2#3$" etc


               Accessing Individual characters of a string










               >>> str = "COMPUTER"
               >>> str[0]     #str[-8]

               C
               >>> str[-1]    #str[7]
               R
               >>> str[3]
               P



               Strings are Immutable

               Part of string can’t be modified in the same memory location, but because of dynamic
               typing whole/complete string can be redefined
   1   2   3   4   5   6