Question: https://www.codechef.com/problems/HS08TEST
my code:
cash=int(raw_input())
balance=float(raw_input())
if cash+0.5<balance and cash%5==0:
balance= balance-cash-0.50
print balance
else:
print balance
but it is running in my compiler
and in online compiler showing runtime error
can any one please rectify it
In the question , we can see that input is in the same line. But in your program input is in two different lines.instead of:
cash=int(raw_input())
balance=float(raw_input())
try:
cash,balance=raw_input().split()
cash = int(cash)
balance = float(balance)
raw_input()
takes input as a string. So, you need to split it w.r.t space and cast the data type you need.
my solution link