1.常规写法:
#! /usr/bin/env python
#coding:utf-8
aliquot = []
for n in range(1,100):
if n%3 == 0:
aliquot.append(n)
print aliquot
2.用list实现:
aliquot = [ x for x in range(1,100) if x%3==0 ] #用list解析,本质上跟上面无太大差异
3.用切片实现:
aliquot = range(3,100,3)#这个不错,简洁