位置:首页 > 软件操作教程 > 编程开发 > Python > 问题详情

python自带函数——范围函数 range

提问人:杨紫红发布时间:2020-11-18

>>> for x in range(0, 5):

print(x)

>>> count_by_twos = list(range(0, 30, 2))

>>> print(count_by_twos)

[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28]

>>> count_down_by_twos = list(range(40, 10, -2))

>>> print(count_down_by_twos)

[40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12]

继续查找其他问题的答案?

相关视频回答
回复(0)
返回顶部