0

In a range(start, end) function in python, why the end value is excluded

print(0,6) # prints numbers from 0 to 5 and the end value 6 is exlcuded

I just want to know why the range function is designed in such a way. Is there any specific reason?

TheMisir
  • 3,615
  • 1
  • 23
  • 35

1 Answers1

0

If you just use an end value, you get that many numbers.

>>> range(6)
[0, 1, 2, 3, 4, 5]

>>> len(range(6))
6
Ben Soyka
  • 741
  • 8
  • 23