Describe Triple Quotes in Python.
Answers
to create strings that span multiple lines,
"triple single quotes"or "triple double quotes" """"are use to enclose the string."this string is on multiple lines within three single quotes on either sides." """"this string is on multiple lines within three double quotes.
The quotation marks are basically used for the print command.
There are three types - ' ' , " ", "' "'
Let's work this out with examples.
print('Hello world!') -- Used the first type
print(" I'am a coder!") -- Used the second type of the quotation marks. I had to use this because I need to get the apostrophe in print, if we typed print('I'am a coder!'), the output would be a error
Now, print("' "I am a coder", he said "') --- I used the third type of quotations to get the double quotation marks in the print.
Hope it helps!