Data can be expressed in the form of a range using Ruby Ranges (in other words a data set with start and end values and a logical sequence of values in between). Numbers, characters, strings, and objects can all be used as range values.
The range operators ".." and "..." are used by Ruby to produce these sequences. The two-dot form provides a range that is inclusive, but the three-dot form creates a range that is exclusive of the provided high value.
The range() function returns a number series that starts at 0 and increments by 1 (by default) before stopping at a specified value.
In contrast to xrange(), the range() method returns a list or sequence of numbers and requires more memory. When compared to a list or tuple, the range() method consumes less memory regardless of the range it covers because it simply keeps the start, stop, and step values.