+ 1

Why is there spaces before love and Python in the output of this code?

https://code.sololearn.com/cHFoTiNVX41i/?ref=app

10th Aug 2017, 1:49 PM
Gogo
Gogo - avatar
2 ответов
+ 3
Comma-separated items automatically get spaced. print( "{}\n{}\n{}".format("but", "not", "this") ) print("or\n", "this\n", sep="") print("or", "this", sep="\n")
10th Aug 2017, 1:53 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
So commas are the reason. So I think if we write the code like this : print ("I\nlove\nPython\n") this will solve the problem. and in fact it did here. But I wonder if there are casses that this won't help. any ideas?
10th Aug 2017, 2:40 PM
Gogo
Gogo - avatar