+ 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
10 Respostas
+ 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.
+ 5
Because that is the prompt you are giving people. It is designed that the prompt is displayed.
+ 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
+ 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.
+ 2
But Honfu my code is not doing as :
Name :sue
Age:21
Its instead showing output as:
Name:age:sue 21
+ 2
Hehehe...so thats y...thanks mate ;)
+ 1
I didn't get it Prometheus
+ 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:
+ 1
So HonFu..there is no way of getting like
Enter something please :12
Enter something again please :13
?
+ 1
That is such a strange behaviour.
Good to be aware of that. Thank you.