(Python) I have problem with inputs in code playground | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

(Python) I have problem with inputs in code playground

I was experimenting and I needed multiple user inputs and it returned me errors, so I made a small code for checking what's going on: print(y := input()) print(x := input()) When run, it takes 1 input and prints it but then it crashes with error: "Traceback (most recent call last): File "file0.py", line 2, in <module> print(x := input()) EOFError: EOF when reading a line" Can somebody explain me what's wrong? Using code playground I can take input only once? If so, why?

3rd Nov 2021, 7:50 PM
Aleksander
7 Answers
+ 4
In playground, we have to provide all input at one. When you have 2 inputs, you need to separate them by linebreaks For example: 3 4
3rd Nov 2021, 7:52 PM
Lisa
Lisa - avatar
+ 3
Yes, seems it doesn't work on web-version If you need it to work, you could use only one input() and split then input by a separator: # example input: # 2 3 x, y = input().split()
3rd Nov 2021, 9:38 PM
Lisa
Lisa - avatar
+ 2
Lisa, it won't let me use linebreaks, hitting enter doesn't work
3rd Nov 2021, 8:02 PM
Aleksander
+ 2
You just type 2 lines instead of 1. It's the return key ↩
3rd Nov 2021, 8:06 PM
Lisa
Lisa - avatar
+ 1
Does Ctrl-Enter break the line inside the input field? I do this in a couple situations.
4th Nov 2021, 10:46 PM
Emerson Prado
Emerson Prado - avatar
0
On the mobile phone I have no problem to separate into 2 lines and it works fine but on pc I can't make 2 lines, nothing works
3rd Nov 2021, 9:09 PM
Aleksander
0
Oh, I forgot about a split! Thanks!
4th Nov 2021, 8:51 AM
Aleksander