Can we print input along with some space followed by another input and then go on | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Can we print input along with some space followed by another input and then go on

In Python!! Str=input() I need input as hi friends how are u all Like this input I want

8th May 2021, 1:20 PM
Keerthi goli
Keerthi goli - avatar
9 Answers
0
I don't understand your question. Please show an example code where what you want doesn't work. I guess you don't want newline after every print? in that case set `end` keyword argument to space ' ' or empty string '' print('hello', end=' ') print('world') # hello world
8th May 2021, 1:28 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
0
Taking input s having space between inputs
8th May 2021, 1:29 PM
Keerthi goli
Keerthi goli - avatar
0
Str only take input as hi but I need to take hi friends how are u all like this Inputs followed by space
8th May 2021, 1:29 PM
Keerthi goli
Keerthi goli - avatar
0
It's working fine for me. If I enter a single line it all gets stored in variable. I just tried this in codeplayground msg = input() #enter hi friends how are u all print(msg) # prints hi friends how are u all
8th May 2021, 1:33 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
0
No you can't take two input in same line. input will behave as it has \n at the end. you can use split method of python to separate your two values after getting it as a single input
8th May 2021, 1:39 PM
Ayush Kumar
Ayush Kumar - avatar
0
丹ⓨㄩک廾 , No. input() doesn't include newline by default. """ The function then reads a line from input, converts it to a string (*stripping a trailing newline*), and returns that. """ https://docs.python.org/3/library/functions.html#input
8th May 2021, 1:48 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
0
I didn't mean that 🇮🇳Omkar🕉 I told that input will behave like as if \n is at its end Yes I had written in bit wrong way sorry for that 🙏
8th May 2021, 1:50 PM
Ayush Kumar
Ayush Kumar - avatar
0
It's okay thank you all
8th May 2021, 1:51 PM
Keerthi goli
Keerthi goli - avatar
0
丹ⓨㄩک廾 Ok. That's fine.
8th May 2021, 1:54 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar