0

In python we put sentences in quotation marks. What if I want to print a quote from Shakespeare? How would I do it?

Python

19th Sep 2023, 1:36 PM
Mario Reategui
Mario Reategui - avatar
4 Answers
+ 6
Single quotes nested double quotes , double quotes nested in single quotes also works as expected. Ex: print( 'This is double quotes: " Symbol' ) print("This is single quotes: ' symbol") or you can use escape character \ like : print( "This is double quotes: \" Symbol" ) print('This is single quotes: \' symbol')
19th Sep 2023, 1:59 PM
Jayakrishna 🇼🇳
+ 5
You can nest double quotes inside single quotes: print('"My love is thine to teach. Teach it but how, and thou shalt see how apt it is to learn. Any hard lesson that may do thee good."')
19th Sep 2023, 2:03 PM
Keith
Keith - avatar
+ 5
# In Python you can make a string between single or double quotes print ('hello') print ("hello") #To use a single quote inside a string with single quotes use backslash \' escape sequence print('let\'s go') # the same for double quotes print("hello \"world\"") # or simply print("let's go") print('hello "world"')
19th Sep 2023, 2:04 PM
Mafdi
Mafdi - avatar
0
shakespeare_quote = "All the world's a stage, and all the men and women merely players." print(shakespeare_quote) shakespeare_quote = 'To be or not to be, that is the question.' print(shakespeare_quote)
21st Sep 2023, 8:13 AM
Mariusz Dawidowski
Mariusz Dawidowski - avatar