Strings in Python

What is String in python?
  • In Python, String is a sequence of characters enclosed by either single quotes or double quotes.
    • Example: 'Python', "Geek4Tutorial"
  • Strings are immutable.
  • Each value in a string is called character. 
Creating a String:
  • Strings can be created by enclosing the sequence of characters inside a single quote or double quote and assign it to a variable.
Strings in Python
  • Sometimes triple quotes can also be used to create a string, even though triple quotes are used to represent Multiline strings and Docstrings.
Strings in Python
  • We can access the characters(element) in the string just like the index using index position.