You are on page 1of 4

Ch- 6: Strings in Python (Part -1)

Click to join telegram channel: Computer by Govind rathore

https://t.me/computer_by_govind_rathore

Key Points of this chapter:


• What is Strings
• Creating Strings
• Traversing a String
• Special String Operators
• String Methods and Built-in-function
What is String:
A string is a sequence of characters. We can enclose characters in quotes (single, double or
triple.)
For example: fruits=’Mango Apple Grapes’
Creating String:
str1=’Hello world’, str2=”Python Programming”
Escape Characters: By using the escape character \" we are able to use double quotes to
enclose a string that includes text quoted between double quotes.
Escape character How it formats

\ New line in a multi-line string

\ Backslash

\n Line break
Escape character How it formats

\t Tab (horizontal indentation)

Empty String: An empty string is a string without any characters inside.


str=” ” , str=’ ‘
Multiple line String: Multiline strings are represented using triple quotes (‘’’ ‘’’) or even single
or double quotes.

Traversing a String: Traversing a string means


accessing all the elements of the string one
after the other by using the subscript / index
value.

You might also like