0

Can anyone help!! .. How to print in a same line in python??

4th Jun 2018, 10:53 AM
Ayushi Verma
5 Respostas
4th Jun 2018, 11:20 AM
AliR૯za
AliR૯za - avatar
+ 4
You can specify a parameter named 'end' in the print function. print(1, end='') print(2, end='3') The result of the above will be: 123 eventhough there were two print functions used.
4th Jun 2018, 1:49 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
python 2.x use, print "something", python 3.x 🌟 use, print("something",end=' ')
4th Jun 2018, 11:30 AM
Venkat
Venkat - avatar
+ 1
Thanks venkat😊
4th Jun 2018, 11:45 AM
Ayushi Verma
0
"end" parameter has new line as its default - end='\n' so print function show some output and switch to new line (so other print function will continue in new line). Kuba Siekierzyński showed clearly how to deal with it if you want the same line. Btw you have also parameter "sep" which define what will separate arguments from the same print function. print(1, 2, sep=',') 1,2 print(1, 2) 1 2 print(1, 2, sep='') 12 sep parameter has blank space as its default, sep=' '
5th Jun 2018, 6:21 PM
Sasha Djekic