002Is He Gonna Survive(8kyu)from codewars

发布时间 2023-10-26 14:38:30作者: jiayusu

Is He Gonna Survive?

A hero is on his way to the castle to complete his mission.However,he's benn told that the castle is surrounded with a couple of powerful dragons!Each dragon takes 2 bullets to be defeated,our hero has no idea how many bullets he should carry.Assuming he's gonna grab a specific given number of bullets and move forward to fight another specific given number of dragons,will he survive?
Return true if yes,false otherwise.
英雄去城堡执行任务。但城堡周围有几只强大的龙。两颗子弹打败一只龙,英雄不知道应该带几颗子弹。假设他将带给定数目的子弹打给定数目的龙,他能活下来吗?
若能活下来返回True,否则返回False。

def hero(bullets,dragons):
    return dragons*2<bullets
hero=lambda bullets,dragons:bullets/2>=dragons