python日记_01 python实现6个人围成一圈,扔到第三个人出局,循环扔的问题。
2015-10-15 16:32 夏洛克·福尔摩斯 阅读(622) 评论(0) 编辑 收藏 举报#!/usr/bin/python shoplist=['mango','apple','carrot','banana','oracle','python'] length = len(shoplist) global n for i in range(length,1,-1): if i==6: n = shoplist.index(shoplist[3]) shoplist.remove(shoplist[n]) print n continue if n+3>i: n=n+3-i-1 shoplist.remove(shoplist[n]) print n continue if n+3<i: n=n+3-1 shoplist.remove(shoplist[n]) print n continue print shoplist
技术成就现在,眼光着看未来。