Python String

String This is the Common Data Type. This data type is commonly found in all Computer Languages.

String This is a sequence of more than one charcaters.

Strings are the most famous data types in any programming language, in Python, String is written in single quotes (”) or double quotes (“”).

To get started with strings, we try a little practice. Look at this example shows how the loop String is used to get every letter from ‘welcome’.

Example for String

var str = "Hello Experts PHP"
print(str)

Output

Hello Experts PHP

Python String Index

String’s index starts with ‘0’ and the last index is ‘-1’.

str = "Hello Experts PHP"
print(str[0])
print(str[-1])

OUTPUT

H
P