Help with ATM problem

def atm(x, y):
if x > y:
print y
if x % 5 != 0:
print y
if x % 5 == 0 and x < y:
print y - x - 0.5

x, y = map(float, raw_input().split())
atm(x, y)

Getting error after submitting the above solution for the ATM problem, but can’t seem to figure out the issue, can someone please help

No need to print value of Y every time, make it better, change in Y once and then just Print it.

x,y = map(float,input().split())
if x%5==0:
    if(x+0.5)<=y:
        y-=(x+0.5)
print(y)

in this code, if your given conditions are true then it will update Y and then print it, and if conditions are failed then it will print Y as it is.

1 Like