How to print one line output using two or more print statements? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 15

How to print one line output using two or more print statements?

1. print ("hello"); print ("world"); 2. print ("hello") print ("world") Both gives same output as: hello world What should we do to give output as: hello world

8th May 2020, 8:21 AM
Puthur Harthik
5 Answers
+ 11
Here you go :)) print('hello ', end='') print('world')
8th May 2020, 8:23 AM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 13
8th May 2020, 8:25 AM
Puthur Harthik
+ 10
Thanks Lothar
8th May 2020, 9:17 AM
Puthur Harthik
+ 8
There is also the possibility of doing it this way: print('hello', 'world!') # or: a = 'hello' b = 'world!' print(a,b)
8th May 2020, 9:12 AM
Lothar
Lothar - avatar
- 1
hello
16th May 2020, 11:47 PM
Madelein