Related to ATM Problem Code: HS08TEST

The following is my code for the problem,it worls fine for all sample inputs but after submitting gives wrong answer:-

w,a=input().split()
w,a=float(w),float(a)
if w>a:
    print("{0:.2f}".format(a))
elif w%5!=0:
    print("{0:.2f}".format(a))
else:
    a=a-w-0.50
    print("{0:.2f}".format(a))

Hi @anuragkothari

This video was very helpful for my understanding,
https://youtu.be/vMuZX3Nh8Lc

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

We can solve this problem by having just two statements in the IF condition.