Print() without a new line | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Print() without a new line

Hi! How can you print without the \n at the end?

29th Apr 2019, 11:20 AM
daniel
daniel - avatar
4 Answers
+ 8
In Python, print receives two optional argument: print(...arr, sep=' ', end='\n') We are interested in end. So, all you need to do is write print('H', end='') print('i')
29th Apr 2019, 11:27 AM
Edwin Pratt
Edwin Pratt - avatar
+ 5
When you have any queries about a keyword in Python, just type help(keyword) and run. Like in this case help(print) would get you enough information.
29th Apr 2019, 7:29 PM
Emoji FanBoy
Emoji FanBoy - avatar
+ 2
I didn't know that, thanks!
29th Apr 2019, 1:07 PM
Aymane Boukrouh
Aymane Boukrouh - avatar