+ 1
In Python, how can someone input two numbers one by one, without entering at once separated by a line in sololearn editor?
inputting numbers one by one
7 odpowiedzi
+ 6
a,b = [int(i) for i in input("Give me two numbers separated by whitespace, now! ").split()]
Split needs no parameters if you accept default whitespace (spaces, tabs, ...)
If you mean read one keystroke at a time, we need to have a different discussion.
+ 1
Thank you so much for the answers. But the code gives "your program needs .. separate lines..." response. after entering numbers I get the addition. this is in sololearn interface. However in my computer, I can see the necessary commands on the screen, such as enter the first number etc. So how can I solve this issue in sololearn? Regards
+ 1
Use this:
input = input().split(", ")
(input() = 10, 9, 4)(input = [10, 9, 4])
0
P, ? .
!
0
again thank you so much. Although I added the commands, I still get "Look like your program needs input. Split multiple inputs into separate lines". In my computer the code runs and requests input with the explanations I specified. But sololearn interface prints "Look like... lines". If it is possible to disable that...