#coding=utf-8
def alive(m, n):
a = range(m)
while len(a)>1:
b = (n%len(a) and n%len(a) or min(len(a), n))-1
yield "%d is died" % a[b]
a = a[b+1:]+a[0:b]
import sys
m, n = len(sys.argv)>2 and tuple(map(int, sys.argv[1:3])) or (30, 6)
for i in alive(m, n):
print i
1: 定位删除的位置
2: 重构LIST
以上是用yield生成器的方式,也可以改成迭代器方式(iter, next)
链接:
http://cloudbbs.org/forum.php?mod=viewthread&tid=13193&page=10&extra=#pid70174
分享到:
相关推荐
077_Sea_of_Tranquility_2.tif
seawater toolbox for general use in processing sea water data such as potential temperature etc. This is version 3.3
本文件包含常用海洋要素的计算方法,在计算常用海洋要素时效果很好
Sea_Duck_900mm_FULL_SIZE.pdf
FT_Sea_Duck_v1.0_Full-Size.pdf
SEA_2.0.zip
simulate sea level with matlab
信号测量时,传感器优化布置的条件数方法。提供自由度信息,输出不同数量传感器的最优布置方案。
SEA_DependencyInjection-源码.rar
信息安全_数据安全_law-w14-swimming_in_a_sea_of_ene 边界防御 数据脱敏 安全运营 风控系统 定向攻击
生成一个给定的强度,提取,和风速方向的海面实现。
matlab seawater 基础程序包
海水要素计算程序包,可以计算海水压强、密度等要素
tsc 海鸥驱动
Sea surface temperature data
matlab seawater数据包,物理海洋研究必备工具
SEA_LimitedSE.US东南亚综合电子业务龙头发展迅速,三大板块协同并进相辅相成
SC-FDMA vs OFDMA for LTE and ...%The Simulation is Updated By Ahmed Abdallah Yassin Belal /Ahmed A.Elmajed Ahmed Mohmmed/Abdelhmeed Ahmed Mohamed Ahmed/Mohamed Ahmed Osman Ahmed (Red Sea university) %
实时海洋动画模拟+体积云模拟,效率一般,可直接运行,附带上帝光后处理。
Cosine doppler diagram of first-order sea clutter direction, broadening and tilting, can be used to obtain the graphs under different ship speeds