In Python, when I use the input() function, how do I reset the EOF so that I can add a second input()? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In Python, when I use the input() function, how do I reset the EOF so that I can add a second input()?

Python allows input from the user with the input() function, however if you try to use input() twice, you get an EOF error

12th Apr 2020, 9:09 PM
Stan Berger
Stan Berger - avatar
3 Answers
+ 5
use this a, b = input().split() instead.
12th Apr 2020, 9:13 PM
Rohit
+ 4
You can use input twice, but then you also have to insert the input into the prompt window, before you start the program, in two lines. This is specific for Sololearn. https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
12th Apr 2020, 9:25 PM
HonFu
HonFu - avatar
+ 1
Well here in sololearn if I need to get multiple inputs I try to get them on a single input like we do in terminal, then I use split() or regex. Otherwise you can do as HonFu says. 😊 One example 👇 https://code.sololearn.com/cwDAM6yW3cxH/?ref=app
13th Apr 2020, 12:45 AM
OR!ON 🛡️
OR!ON 🛡️ - avatar