0

Why does this code doesn't work & what's the correct way?

x = "spam" print( x\n * 2 )

15th May 2021, 12:35 PM
Praveen
Praveen - avatar
8 Réponses
+ 3
Praveen You can do like this also x = "spam" print ((x + "\n") * 2)
15th May 2021, 12:45 PM
A͢J
A͢J - avatar
+ 1
Thank You So Much it worked 👍
15th May 2021, 12:46 PM
Praveen
Praveen - avatar
0
Why does line break doesn't work here?
15th May 2021, 12:36 PM
Praveen
Praveen - avatar
0
So how can I do this code without error?
15th May 2021, 12:38 PM
Praveen
Praveen - avatar
0
spam spam
15th May 2021, 12:40 PM
Praveen
Praveen - avatar
- 2
Praveen What is \n here?
15th May 2021, 12:35 PM
A͢J
A͢J - avatar
- 2
Praveen line break works when you write inside double quotes or single quotes.
15th May 2021, 12:37 PM
A͢J
A͢J - avatar
- 2
Praveen What output you expect?
15th May 2021, 12:39 PM
A͢J
A͢J - avatar