How to allign the string inside the brackets in a single line | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

How to allign the string inside the brackets in a single line

Also..why do the string appear in the output anyway...i didnt command any print to print it at the output https://code.sololearn.com/cdXfbCqE7SsO/?ref=app

28th May 2019, 9:00 AM
Y AD Ù
Y AD Ù - avatar
10 Antworten
+ 3
That is because SoloLearn is weird. It takes all your input you give here on Sololearn and somehow substitutes it where your input statements are and runs it on the SoloLearn PC, then only the output is sent back to you. It's not the normal behavior. Try the same code on your PC's Python or on your smartphone QPython3 or something and the output will be just as expected.
28th May 2019, 9:28 AM
HonFu
HonFu - avatar
+ 5
Because that is the prompt you are giving people. It is designed that the prompt is displayed.
28th May 2019, 9:05 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
You can't align the inputs in one line. When the user hits enter, there will be a line change. You are passing the string as argument to the input function, and from there it gets printed out. I guess it's supposed to be convenient. I don't use it a lot myself because I want to embed the input in an input check without printing the prompt over and over. print('(y)es or (n)o?', end=' ') while True: inp = input().strip().lower() if inp in ('y', 'n'): break
28th May 2019, 9:10 AM
HonFu
HonFu - avatar
+ 2
name: Sue age: 21 sex: f This is possible, both our codes do that. (Here on Sololearn you don't see it because SoloLearn has no normal runtime for Python, but running it locally on your PC or smartphone will show it.) name: Sue age: 21 sex: f This is not possible because the user hits enter after each entry.
28th May 2019, 9:22 AM
HonFu
HonFu - avatar
+ 2
But Honfu my code is not doing as : Name :sue Age:21 Its instead showing output as: Name:age:sue 21
28th May 2019, 9:26 AM
Y AD Ù
Y AD Ù - avatar
+ 2
Hehehe...so thats y...thanks mate ;)
28th May 2019, 9:30 AM
Y AD Ù
Y AD Ù - avatar
+ 1
I didn't get it Prometheus
28th May 2019, 9:06 AM
Y AD Ù
Y AD Ù - avatar
+ 1
Okay..thn how to allign them on a different lines like Enter something please: Enter something again please: And not like Enter smthing pls: enter something again please:
28th May 2019, 9:07 AM
Y AD Ù
Y AD Ù - avatar
+ 1
So HonFu..there is no way of getting like Enter something please :12 Enter something again please :13 ?
28th May 2019, 9:14 AM
Y AD Ù
Y AD Ù - avatar
+ 1
That is such a strange behaviour. Good to be aware of that. Thank you.
29th May 2019, 5:27 AM
Michael U.
Michael U. - avatar