Search code examples
pythoninputpycharm

Python second input() in a row returns empty string when


When I'm having two input() in a row, the second one returns empty string.

y = input()
b = input()
print('y='+y)
print('b='+b)

Output:

2020
2020
y=2020
b=

However, when I'm passing __prompt to the second input, it works fine:

y = input()
b = input('inp2 ')
print('y='+y)
print('b='+b)

Output:

2020
inp2 2020
y=2020
b=2020

What am I missing and how can I fix it without passing __prompt?


Solution

  • Tried same using Visual Studio Code, it works as expected. So the problem is in my previous IDE (PyCharm Edu 2022.1.1)