Why is there no quote in the output | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Why is there no quote in the output

print("Hello\nWorld!")

14th Jun 2019, 2:54 PM
Joshua
Joshua - avatar
4 Respostas
+ 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