about NZEC error

I am getting NZEC error on python 3.6 while running this code

cook your dish here

x,y=input().split(" ")
if(x<y and x%5==0):
this code is from practice(Beginner) → ATM
please help me out
I am new on this platform

@saacar This code provides a correct answer:
I changed up the input a bit making both x and y as floats and another mistake in your code was that x should not only be greater than y but it should be greater than (y+0.5). To explain this consider the following example:

Your bank account has $5 so it is divisible by 5 but the bank also charges $0.5 for transaction and at the end you will have -$0.5 as your balance. However, this is not allowed.

Another thing to keep in mind is that the question specifies that the output must have two decimal places. The code you have submitted provides one decimal place. For this a “%.2f”% code has been added.

if x%5==0 and (y-0.5-x)>= 0:

Hope this helps!

I will try not to repeat same mistakes again

You’re Welcome!
Don’t worry, we’re all here to learn :slight_smile:

1 Like