Beyond Understanding

Accepted:
n,atm=map(float,input().split())
n=int(n)
if (n+0.5<=atm and n%5==0):
print(float(atm-n-0.5))
else:
print(float(atm))

Giving a runtime error::
a,b=map(float,input().split())
a=int(a)
if (a%5==0 and a+0.5<=b):
print(float(b-a-0.5))
else:
print(float(b))

Can’t understand why

@shanya_awasthi - I ran your Runtime error code with correct indentation - it didnt give me any error - CodeChef

If you are ‘compiling’ - then you will get runtime error if you sample input box is empty. Add some input to it and compile.

Even after running it with input. It’s giving run time error after submission

If you are talking about this - CodeChef - code of yours, then the problem is that instead of

a,b=map(float,input().split())

you are doing

a,b=map(float,input().split(" "))

The second code will give runtime error on submitting because it seems that the Problem has extra whitespaces in the input test cases. Not giving any parameter to split will by default ignore any number of whitespaces, thus that code gets Accepted.

Thank you very much :blush: