0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PythonでEOFError: EOF when reading a lineのエラー

Posted at

Atcoderでコードテストをしたら「EOFError: EOF when reading a line」が表示された。

・その時のソース。

a = int(input())
b = int(input())

product = a * b
if product % 2 == 0:
  print('Even')
else:
  print('Odd')

・エラー

Traceback (most recent call last):
  File "/judge/Main.py", line 1, in <module>
    a = int(input())
            ^^^^^^^
EOFError: EOF when reading a line

input()の中に何も入れてないから入力がないよって怒られた。

a = int(2)
b = int(3)

product = a * b
if product % 2 == 0:
  print('Even')
else:
  print('Odd')

これで直った。
提出するときはinputの引数入れないけど、コードテストの時は具体的な値を入れてあげないとエラーになってしまうってことでした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?