You are not logged in. Please login at www.codechef.com to post your questions!

×

Taking input Python

Hello, I am a rookie programmer and only recently started using CodeChef. I was testing out the CodeChef ide and realised that I got an error everytime i tried to take input on the Python ide. The error triggered for both the input() and raw_input() functions.If someone could suggest a fix or an alternative method of taking input, I'd appreciate it.
My code:

x = input()

Error:
Traceback (most recent call last):
File "./prog.py", line 2, in <module>
EOFError: EOF when reading a line

asked 10 May '15, 14:18

x_anonymous_x's gravatar image

0★x_anonymous_x
111
accept rate: 0%


try to provide some input in custom input and then run

link

answered 10 May '15, 16:56

chandan2495's gravatar image

3★chandan2495
463
accept rate: 0%

EOF error results usually in an online judge like CodeChef when an input is given by the system but the input reading line is not at the right place to read it. Read the sample input syntax again and try.

link

answered 26 Nov '16, 19:05

bkishan29's gravatar image

0★bkishan29
262
accept rate: 25%

Its happen because when the compiler compile the code it get EOF at end and nothing else to do. Try using try-except method for this

while True: try: a = input() except EOFError: print ("EOFError") break

and you can provide some custom input also.

link

answered 26 Nov '16, 19:20

akash_441442's gravatar image

1★akash_441442
11
accept rate: 0%

edited 26 Nov '16, 19:23

Give the input by your own in custom input

link

answered 08 Jan, 20:40

samridh_2112's gravatar image

0★samridh_2112
1
accept rate: 0%

-1

Yeah you had not given any custom data.

link

answered 10 May '15, 20:53

binay_misra's gravatar image

1★binay_misra
84216
accept rate: 5%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×267
×169
×20

question asked: 10 May '15, 14:18

question was seen: 14,131 times

last updated: 08 Jan, 20:40