0

Need some clarification

I can't for the life of me remember what "range" is and what it does. I believe it is related to integers, but I don't remember what else.

19th Jan 2018, 1:39 AM
SerenityPrim3
SerenityPrim3 - avatar
2 ответов
+ 3
Returns an array of integers between the 2 integer parameters.
19th Jan 2018, 1:47 AM
Jacob Pembleton
Jacob Pembleton - avatar
+ 3
The range function is used to create sequences of integers. You can use one, two, or three parameters. If you use only one parameter, the sequence will start with zero and end with one less than the input (n - 1). For example, range(4) creates [0, 1, 2, 3]. Using two parameters, the first number will be the starting point and the second is the ending point. Note that the ending point is not included in the sequence. For example range (1,4) will create [1, 2, 3]. If you use three parameters, the last number will be the "step," meaning the intervals between numbers in the sequence. For example, to produce even numbers only, the step would be 2. The basic format for range is: range(start, beyondLast, step) Hope this helped 🤘
19th Jan 2018, 2:13 AM
Daniel Muhlbach
Daniel Muhlbach - avatar