1 / 4
Jul 2011

code:

N = input() 
inpa =  str( input() )
while N > 0:
    lista = inpa.split(" ")
    suma = 0
    for num in lista: 
        vala = str( num )[::-1] 
        suma = suma + int( vala ) 
    suma = int( str( suma )[::-1] )    
    print (suma)
    inpa = str( input() )
    N = N - 1

I'm using 3.X python
not sure why this blows up as it runs fine in VS. pyConsole
any assistance would be much appreciated

  • created

    Jul '11
  • last reply

    Jul '11
  • 3

    replies

  • 315

    views

  • 2

    users

If you had tested this code with a Python 3.x interpreter you would have easily found out what is wrong.

[bbone=Python,250]>>> "4">0
Traceback (most recent call last):
File "", line 1, in
TypeError: unorderable types: str() > int()[/bbone]

Awesome appreciate that correction, but that isn't what is causing the "NZEC" error.
The compiler does catch that I'm trying to cast a string to an int and in the example it says to expect an int.
As I mentioned I did test this with a Python 3.x interpreter( VS has an addon for that), it gave a warning not an error. So as long as the string doesn't contain non-digits it should compile and execute.

If you can point out more then a generic. Am I using a deprecated syntax on the string reversal or something?
This is my 1st attempt at python

You are wrong. It causes definitely a NZEC.
You are right. It is not the only thing that causes a NZEC: You are reading beyond EOF.