What is the difference between ' and " when using the print command? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between ' and " when using the print command?

Examples: print('hello') and print("hello") they result in the same output.

27th Jun 2016, 3:49 PM
Rod
Rod - avatar
1 Answer
0
There is no real difference both is working and valid. But there is one useful thing you can do with this: print('What's the matter') won't work because the interpreter would end the string at the second " ' ". One way to make this work is to use a escape character like this: print('What\'s the matter') but another way is this: print("What's the matter"). Hope this was understandable :)
28th Jun 2016, 1:15 AM
Yannic Wehner