# 输出1-20之间的所有素数res = []mark = 0for i in range(2,20): for j in range(2,int((i/2)+1)): if i % j == 0: mark = 1 if mark == 0: res.append(i) mark = 0print(res) # [2, 3, 5, 7, 11, 13, 17, 19]