2014-02-21 53 views
0
initial_bal = int(input("enter initial balance")) 
withdraw_money = int(input("enter balance to withdraw")) 
f = 0 
if withdraw_money % 5 == 0 : 
    if (withdraw_money + 0.5) <= initial_bal: 
     f = 1 

if f == 1: 
    account_bal = initial_bal - (withdraw_money + 0.5) 
    print ("remaining balance : " , account_bal) 
else : 
    print(initial_bal) 

当我上面所写的代码codechef提交的,则投掷运行时错误(NZEC)。它在我的机器上工作得很好。 任何人都可以告诉,我的代码中的错误在哪里?蟒运行时间错误(NZEC)

+1

这是Python的3.x的代码,你从列表中选择Python 3中的实际代码? – thefourtheye

+0

https://github.com/SavinaRoja/PyUserInput或https://fedorahosted.org/dogtail/将会更喜欢。 – Torxed

+0

不是实际...... – user3157110

回答

1

首先,您不必像打印东西那样打印“输入初始余额”。你只需要打印测试用例中给出的内容。只是打印什么在测试情况作了说明..其它...
这是蟒蛇

class Main: 

    s=raw_input() 
    s=s.split(" ") 
    x=float(s[0]) 
    y=float(s[1]) 
    if(x%5==0 and x+0.50<=y): 
     p=y-x-0.50 
     print("%.2f"%p) 
    else: 
     print("%.2f"%y)