Python ALIVE AND DEAD – JosephLoendorf
def yuesefu(nums, step, stay):
#参数 nums:人数,step: 数到几的步数,stay: 最后留下多少人
lists = list(range(1, nums+1))
check =0
while len(lists)> stay:
for i in lists[:]:
check +=1
if check == step:
check =0
lists.remove(i)
print("{}号下船了".format(i))
return lists
stays = yuesefu(30,9,15)
print("最后留下的人:", stays)