0

How to line break in Python?

I've tried \n and "\n" and it does not recognise it. print("I want to \n buy a cake.") Or print("I want to" + \n + buy a cake.") #i know that manually breaking the line achieves nothing. I just do it for the sake of keeping the code neat.

24th Jan 2021, 8:46 AM
João Dias
João Dias - avatar
1 Respuesta
+ 9
print("I want to" + "\n" + "buy a cake") "\n" is also a string that has escape sequence that is why it should also have "" around it, and if you want to concatenate strings.
24th Jan 2021, 8:47 AM
noteve
noteve - avatar