What is the range of range(1)

range(1)The range of is a sequence of integers of length 1 starting from 0, ie: [0].

It should be noted that in Python, rangethe starting value of the function is 0 by default, and its parameters are not included in the scope. So, if you want to generate a sequence of integers starting at 1, you can use range(1, n), where nis the length of the sequence of integers you want to generate.

Guess you like

Origin blog.csdn.net/weixin_35755434/article/details/129616480