+ 1

New line is not printing in print by using stings....why..?

eg:print("hello\nworld"*3) here in this example out is not printing like :hello world three times it is printing same line 3 times...

11th Jul 2018, 12:14 PM
yogananda reddy
yogananda reddy - avatar
3 odpowiedzi
+ 2
Try this: print("hello\nworld\n"*3)
11th Jul 2018, 12:35 PM
E_E Mopho
E_E Mopho - avatar
0
It's because the "\n" is at the middle of the string, not the end. Here's the correct code :: print("Hello World\n"*3)
11th Jul 2018, 12:28 PM
Dlite
Dlite - avatar
0
use print('hello'+('/n'*3)+'world') because you are using will print the entire string three times.
11th Jul 2018, 12:31 PM
Pulkit Kamboj
Pulkit Kamboj - avatar