1046 | CodeChef. Help Needed! I would appreciate it!

Hello. I’ve been trying this problem out for 30 minutes but I still can’t seem to get it to work. When I run it in the Python app, the desired output comes out, but when I submit it here, it gives me a Runtime Error. I would appreciate it a lot if you guys could help me out with this. Thanks.

Here is my code:
a = input()
x = a.split(’ ')

total = int(x[1])

if (int(total)%5 == 0):
total -= int(x[0]) - 0.50
total = total

1 Like

Use float, not int.

Also, you need to perform a check to see if the account has insufficient funds.

Here’s my solution for reference

#map function assigns the respective values to the variables. Notice the use of float.

Below code checks whether the amount to be withdrawn is a multiple of 5
and also simultaneously checks if there is sufficient balance in the account and
prints the output accordingly. We print the output with 2 digits precision i.e 
two digits after the decimal point
if (x%5==0 and (x+0.50)<y):

If you have any questions, feel free to ask.

Hope this helps,