您的位置:首页 > 其它

checkio的日子(2)

2013-08-30 15:55 411 查看



def checkio(data):
data[0] += data[1]
data[2] -= data[3]
if int(data[0]) <= int(data[2]):
checkio(data)
if int(data[0]) > int(data[2]):
if data[0] >= data[2] + data[3]:
return data[2] + data[3]
else:
return data[0]
else:
if data[0] >= data[2] + data[3]:
return data[2] + data[3]
else:
return data[0]
#Some hints
#Be careful with endless loop
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio([150, 50, 1000, 100]) == 450, "1st example"
assert checkio([150, 50, 900, 100]) == 400, "2nd example"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Spaceship Purchase