+ 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
5 Respuestas
+ 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