Why is there no quote in the output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is there no quote in the output

print("Hello\nWorld!")

14th Jun 2019, 2:54 PM
Joshua
Joshua - avatar
4 Answers
+ 4
The quotes signify a string, to add quotes you need to add a second set inside the first and escape them: print(“\”Hello\nWorld!\””)
14th Jun 2019, 3:32 PM
Jackson O’Donnell
+ 2
code?
14th Jun 2019, 2:56 PM
Cat Sauce
Cat Sauce - avatar
+ 2
printing strings by themselves will not give quotes. Use string repr. print("{}\nWorld!".format(repr("Hello"))) 'Hello' World!
14th Jun 2019, 3:15 PM
Choe
Choe - avatar
+ 2
Thanks guys I get it now🙏
14th Jun 2019, 8:36 PM
Joshua
Joshua - avatar