How to print without changing line? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to print without changing line?

print(123) a=456 print(a) how to output 123456 not 123 456?

29th Jul 2016, 12:00 PM
X_Tu
X_Tu - avatar
6 Answers
+ 4
to stop print from switching to a new line use: print("this is going to be printed", end="") so, to get your desired output, use this: print(123,end="") a=456 print(a) keep in mind that this does not work like this in python 2
29th Jul 2016, 2:23 PM
RedAnt
RedAnt - avatar
+ 1
a=456 print(123,a) try this
29th Jul 2016, 12:46 PM
sundar
sundar - avatar
+ 1
@RedAnt Thank you.
30th Jul 2016, 12:16 AM
X_Tu
X_Tu - avatar
0
i don't mean this!that's just a example.
29th Jul 2016, 1:06 PM
X_Tu
X_Tu - avatar
0
Ok ask your expected output we may help better
29th Jul 2016, 1:18 PM
sundar
sundar - avatar
- 2
phithon
29th Jul 2016, 12:41 PM
hailey15