In Python, how can someone input two numbers one by one, without entering at once separated by a line in sololearn editor? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

25th May 2018, 10:20 PM
Halil Rıdvan OZ
Halil Rıdvan OZ - avatar
5 Answers
+ 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.
26th May 2018, 2:42 AM
Kirk Schafer
Kirk Schafer - avatar
+ 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
28th May 2018, 6:42 PM
Halil Rıdvan OZ
Halil Rıdvan OZ - avatar
+ 1
Use this: input = input().split(", ") (input() = 10, 9, 4)(input = [10, 9, 4])
28th May 2018, 7:02 PM
Arthur Bacci
Arthur Bacci - avatar
0
P, ? . !
27th May 2018, 12:17 PM
Ousmane Mathieu Kagone
Ousmane Mathieu Kagone - avatar
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...
29th May 2018, 9:08 AM
Halil Rıdvan OZ
Halil Rıdvan OZ - avatar