0

"" or ''

Do we use " " or ' ' inside the parenthesis to print the statement ?

4th Oct 2018, 8:03 AM
Hrithik Chugh
Hrithik Chugh - avatar
3 Réponses
+ 4
You are free to use either single or double quotes for printing a string, just remember not to wrap numbers with quotes; don't wrap with quotes if you want to print numbers, as expression or as arithmetic calculation. And there's no need to wrap variable name with quotes either; print("This is a string") print('This is also a string') # printing arithmetic calculation print(2 * 21) # output: 42 magic_number = 42 # printing variable value print(magic_number) # output: 42
4th Oct 2018, 8:24 AM
Ipang
+ 3
Whichever you like! Just start and close with the same one. We have this choice so we can use quotation marks inside our string, like print('She said, "Hello, Solo!"') Output: She said, "Hello, Solo!" (Although there are other ways to achieve this.)
4th Oct 2018, 8:24 AM
Kishalaya Saha
Kishalaya Saha - avatar
4th Oct 2018, 11:57 AM
Maninder $ingh
Maninder $ingh - avatar