1046 | CodeChef Help Needed! Would be in debt if you could help me!

Hey! My code to answer the question in my opinion looks reasonable and the logic is hopefully great. But I am still receiving a Wrong Answer mark from Code Chef. If someone were able to help me I would be very appreciating.

Here’s my code:
X = input()
X1 = X.split(’ ')
withdraw = float(X1[0])
total = float(X1[1])

if (float(withdraw)%5 == 0 and float(withdraw) < total):
total = total - float(withdraw) - 0.50
formatted_float = “{:.2f}”.format(total)
print(formatted_float)
elif (float(withdraw)%5 != 0 and float(withdraw) < total):
formatted_float = “{:.2f}”.format(total)
print(formatted_float)
else:
formatted_float = “{:.2f}”.format(total)
print(formatted_float)

Make the following modifications, it should work now

if int(withdraw)%5==0 and withdraw + 0.5 <= total:
    # something here
else:
    # something else here
2 Likes