DEV Community

Jay
Jay

Posted on

range

The range of a function is domain beginning with x to and end point y.
e.g: P(x,y)

As the term "range" can have different meanings, it is considered a good practice to define it the first time it is used in a textbook or article. Older books, when they use the word "range", tend to use it to mean what is now called the codomain.

Create a sequence of numbers from 2 to 2, but increment by 3 instead of 1:

for n in range(2, 12, 3):
    print(n)
Enter fullscreen mode Exit fullscreen mode

The formula is

for variable in range(start, end, increment) you should
print(variable)

Top comments (0)