range(start, stop[, step])
自我理解
- range函数包含三个参数必须是整型,start、stop、step
- start开始参数,可缺省,默认为0
- stop结束参数,必须
- step步长参数,可缺省,默认为1
1、Dash中函数说明
-
range(start, stop[, step])
-
start
The value of the start parameter (or 0 if the parameter was not supplied) -
stop
The value of the stop parameter -
step
The value of the step parameter (or 1 if the parameter was not supplied) -
range()函数最多可包含三个参数
-
start开始参数,如果缺省,则从0开始
-
stop结束参数,这个是必须的
-
step步进值,如果缺省,则为1
for i in range(1, 11):
print(i, end=" ")
for i in range(10):
print(i, end=" ")
for i in range(-10):
print(i, end=" ")
for i in range(0, -10, -1):
print(i, end=" ")
#1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 0 -1 -2 -3 -4 -5 -6 -7 -8 -9
#stop为负值且另外两个参数缺省时无输出