Python returning NZEC in ATM

#ankitchanne
def atm(w):
fund=30000.00
w=input()
total=w+w*0.50/100
if w%5==0 and fund-total>=0:
print fund-total
else:
sys.exit()
atm(0)

this is my code.But I am getting NZEC. help-the-noob

The problem statement says that you are supposed to take 2 inputs:

the amount to be withdrawn and the the balance

You are taking only 1 input, that is, the amount to be withdrawn.
I don’t know why you are assuming fund(balance) to be equal to 3000. You are supposed to take it as input.

There is no need to add 0.5% into w.

Here’s the explanation of what the problem statement says:

w=amount to be withdrawn

b=balance

if w is a multiple of 5 and w<=b-0.5

then b=b-0.5-w

now just print b

Here’s the link to my submissions of this question in python,C/C++: click here

1 Like

thank-you…I mis-interpreted the question.

#ankitchanne
def atm():
w=float(input())
t=float(input())
if w%5==0 and t>=w+0.5:
b=t-w+0.50
print “%.2f”%b
return 0
else:
return 0
atm()

this is my code but still I amg getting NZCEC

Use raw_input() for input and then use split(’ ') function to split the input.

Here’s the code for the same:

<b>s=raw_input()

s1=s.split(' ')<Br>
w=int(s1[0])<Br>
t=float(s1[1])<BR></b>

Also check my solution for the same, it will clear all your doubts.
The link is my answer before this one.

//