range() is a built-in function of Python. It is used when a user needs to perform an action for a specific number of times. The
range() function is used to generate a sequence of numbers. But the sequence of numbers produced by range is generally either decreasing or increasing linearly which means it is either incremented and decremented by a particular constant.
rangev2 module provides a function
new_range() which allows to produce sequence also by using
*, //, % operators so that sequence can be varied exponentially is well.
This module does not come built-in with python, so it can be installed by typing the below command in the terminal.
pip install rangev2
Syntax: new_range(start, stop, step)
start – integer starting from which the sequence of integers is to be returned.
stop – integer before which the sequence of integers is to be returned.
step – string containing operand and operator.
2 4 8 16 32 64 2 4 16 256 100 33 11 3
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- How to download and install Python Latest Version on Windows
- Download and Install Python 3 Latest Version
- How to download and install Python Latest Version on Android
- How to download and install Python Latest Version on macOS / Mac OS X
- How to download and install Python Latest Version on Linux
- Find the version of the Pandas and its dependencies
- Download and install pip Latest Version
- PyQt5 QSpinBox - Getting translated version of text
- Zip function in Python to change to a new character set
- Python | Return new list on element insertion
- Python | Add new keys to a dictionary
- Python PIL | Image.new() method
- Awesome New Features in Python 3.8
- Open a new Window with a button in Python-Tkinter
- How to create a new thread in Python
- Using mkvirtualenv to create new Virtual Environment - Python
- How to Filter and save the data as new files in Excel with Python Pandas?
- Connect new point to the previous point on a image with a straight line in Opencv-Python
- What's new in Python 3.9?
- Python VLC Instance - Creating new Media Instance
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.