pardon110
就需求而言,本质上就是在指定范围内寻找能被4整除的数def div4(s,e):
s= s//4+1 if s%4 else s//4
e = e//4 + 1
d = []
for i in range(s,e):
d.append((i*4,'小红' if i%2 else '小红小白'))
return d[:]
print(div4(10,150))效果如下[(12, '小红'), (16, '小红小白'), (20, '小红'), (24, '小红小白'), (28, '小红'), (32, '小红小白'), (36, '小红'), (40, '小红小白'), (44,
'小红'), (48, '小红小白'), (52, '小红'), (56, '小红小白'), (60, '小红'), (64, '小红小白'), (68, '小红'), (72, '小红小白'), (76, '小红'), (80, '小红小白'), (84, '小红'), (88, '小红小白'), (92, '小红'), (96, '小红小白'), (100, '小红'), (104, '小红小白'), (108, '小红'),
(112, '小红小白'), (116, '小红'), (120, '小红小白'), (124, '小红'), (128, '小红小白'), (132, '小红'), (136, '小红小白'), (140, '小红'), (144, '小红小白'), (148, '小红')]