Sobes.tech
Middle

What is the difference between range(101) and range(0, 101)?

sobes.tech AI

Answer from AI

In Python, calls to range(101) and range(0, 101) are completely equivalent.

  • range(101) creates a sequence of numbers from 0 to 100 inclusive, where 0 is the default start value for the range.
  • range(0, 101) explicitly specifies the start of the range at 0 and the end at 101 (excluding 101).

Therefore, there is no difference in the result; it is simply different syntax for the same range.