获取等差数列思路
1. 通过range步长
2. 通过切片步长
# 通过 range
series = [i for i in range(1, 101, 2)]
print(series)
# 通过切片
series_two = [i for i in range(1, 101)][::2]
获取等差数列思路
1. 通过range步长
2. 通过切片步长
# 通过 range
series = [i for i in range(1, 101, 2)]
print(series)
# 通过切片
series_two = [i for i in range(1, 101)][::2]
转载于:https://www.cnblogs.com/2bjiujiu/p/9078818.html