Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
Can anyone help!! .. How to print in a same line in python??
5 Respostas
+ 12
is this what you want?
https://code.sololearn.com/c87HDsS216mG/?ref=app
+ 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.
+ 2
python 2.x
use,
print "something",
python 3.x š
use,
print("something",end=' ')
+ 1
Thanks venkatš
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=' '