Discuss / Python / 小白求教list(range(1, 11))为什么最后的结果有1没有11呢

小白求教list(range(1, 11))为什么最后的结果有1没有11呢

Topic source

如题

--Groot

#2 Created at ... [Delete] [Delete and Lock User]

range(m, n)含义是从m到n但不包含n

zbn2068133386

#3 Created at ... [Delete] [Delete and Lock User]

是从11开始不包含的,即开始不包含的首位

大晨紫Zzz

#4 Created at ... [Delete] [Delete and Lock User]

简而言之就是:顾头不顾尾。


  • 1

Reply