It is sequence of character. In other words, it is the collection of the characters surrounded by single quotes, double quotes, or triple quotes. Generally, triple quotes are used to represent multiline strings and docstrings.
'hello' is the same as "hello". You can display a string literal with the print()
function.
The computer does not understand the characters; internally, it stores manipulated character as the combination of the 0's and 1's. These character are encoded with ASCII or Unicode.
Example: Single Quotes
Str = 'Welcome to ProgramsBuzz'
print(Str)
Output: Welcome to ProgramsBuzz
Example: Double Quotes
str_1 = "Welcome to ProgramsBuzz"
print(str_1)
Output: Welcome to ProgramsBuzz
Example: Triple Quotes
str_1='''Welcome to ProgramsBuzz'''
print(str_1)
Output: Welcome to ProgramsBuzz
- Log in to post comments