amount=int(input())
balance=initial=float(input())
if amount%5==0 and amount+0.5<initial:
balance=initial-amount-0.5
print(balance)
What is wrong with this code, i am getting a run time error .But i got output in my compiler
amount=int(input())
balance=initial=float(input())
if amount%5==0 and amount+0.5<initial:
balance=initial-amount-0.5
print(balance)
What is wrong with this code, i am getting a run time error .But i got output in my compiler
in Python input() reads the whole line which also contains the space character. Do it like this.
cash, balance = map(float, input().split())
if(cash%5 != 0 or cash+0.5 > balance):
print(balance)
else:
print("{:.2f}".format(balance-cash-0.5))