+ 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?
7 Respuestas
+ 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
+ 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()
+ 2
Lisa, it won't let me use linebreaks, hitting enter doesn't work
+ 2
You just type 2 lines instead of 1. It's the return key ↩
+ 1
Does Ctrl-Enter break the line inside the input field? I do this in a couple situations.
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
0
Oh, I forgot about a split! Thanks!