位置:首頁 > 軟件操作教程 > 編程開發(fā) > Python > 問題詳情

python自帶函數(shù)——范圍函數(shù) range

提問人:楊紫紅發(fā)布時(shí)間: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]

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部