Search code examples
pythonpycharmvalueerror

Pycharm output empty value


I have the following code:

def area(x, y):
    return x*y
w = int(input())
h = int(input())
print(area(w,h))

Every time I run it in Pycharm,VS works fine, it gave me this error:

ValueError: invalid literal for int() with base 10: ''

Also I tried switching int() to float() and this error appear:

ValueError: could not convert string to float: ''

It seems like the second input is always empty . Thanks in advance

Python 3.8 PyCharm 2022.1.1 (Community Edition) Build #PC-221.5591.52, built on May 10, 2022 Runtime version: 11.0.14.1+1-b2043.45 amd64


Solution

  • this issue seems to be known and fixed: https://intellij-support.jetbrains.com/hc/en-us/community/posts/5609658115218-error-on-user-input Simply upgrade PyCharm and it will work.