1 / 3
Apr 2012

Hello!!!

I wrote a program in python and it worked fine in my computer, so when I always submit it in SPOJ server it always returns "wrong answer" warning. Because the script worked fine in my computer I think it is a problem involving an input/output issue. So I wonder what is the way in that the SPOJ server takes the input?

Here I paste the code

#!/usr/bin/python
num = [1, 2, 88, 42, 99]
def function(num):
    for i in range(len(num)):
        if num[i] == 42:
            break
        print num[i]
function(num)

Thank you all a lot...

  • created

    Apr '12
  • last reply

    Apr '12
  • 2

    replies

  • 468

    views

  • 2

    users

The SPOJ judge submits a file to standard input, which your program reads and generates standard output. The judge then reads the output from your program and verifies it against it's solution.

The sample input is just that, a sample. The real input will likely be quite a bit more involving. If you look at the language specific section of the forum you will see sample code for the problem TEST, which is the one you are solving.

Also read the tutorials on the main page. They are useful.