NZEC error in a simple Python code -
this similar question nzec error in python has been answered. approved answer not work me.
i tried doing problem on codechef (http://goo.gl/chym4w) using following code:
x, y = raw_input().split(" ") x = int(x) y = float(y) if x%5 == 0 , y-x-0.5 >= 0: y = y-x-0.5 print "%0.2f" % y
this gives me nzec error. if change
user_input = raw_input().split() x = int(user_input[0]) y = float(user_input[1]) if x%5 == 0 , y-x-0.5 >= 0: y = y-x-0.5 print "%0.2f" % y
the code works alright. can please explain why first approach isn't working?
when tried raw_input().split(" ") , given nzec error because when problem setter tried upload i/o test cases left space @ end. example if have input ..
1
3 2
then after 3 , 2 have space left after 2, led nzec error in python. remember instead of using split(" ") , use split() . problems remain setter uploaded input test case , not code logic.
Comments
Post a Comment