PYTHON STRING

                 PYTHON     PROGRAMMING  --  STRING


STRING:

        1. It is a derived data type.

        2.Strings are immutable. this means that once defined ,they cannot be changed.

        3.Index position starts from 0.

STRING  INDEX ( ):

            The index( ) method finds the first occurrence of the specified  value.

       EXAMPLE:



 STRING  FUNCTIONS:

        1.SLICING:

                👉Python Slicing is about obtaining a sub string from the given string by slicing.

            SYNTAX:
                    String[Start : End +1]

            EXAMPLE:

       2.STRING  CONCATENATION:

                👉String Concatenation is  the technique of combining two strings.

               👉It is using '+' operator.

             EXAMPLE:



  3.STRING  LENGTH:

           👉It takes a string as a parameter and returns an integer as the length of that string.

           👉We can use the built in len() method.

           EXAMPLE:

   4.FIND ( ):

                   The find( )  method finds the first occurrence of the specified value.

       EXAMPLE:

    5.UPPER  CASE:

                 The upper method  return the string in upper case.

             EXAMPLE:

    6.LOWER  CASE:

                The lower method return the string in lower case.

             EXAMPLE:

      
  

     7.SPLIT THE STRING:

                The split method returns a list where the text between the specified separator becomes the list items.

        EXAMPLE:


8.ISUPPER ( ):

             The isupper() method checks whether all the characters of a given string are uppercase or not. It returns True if all characters are uppercase and False even if one character is not in uppercase.

EXAMPLE:

    


9.ISLOWER ( ):

         The islower() method returns True if all characters in the string are lowercase, otherwise, returns “False”. 

EXAMPLE:


10.TITLE ( ):

            The title() function which is used to convert the first character in each word to Uppercase and remaining characters to Lowercase in the string and returns a new string.

EXAMPLE:


11.COUNT ( ):

         It will return the total count of a given element in a string. The counting begins from the start of the string till the end.

EXAMPLE:





        



Comments