๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_func_range.asp
Python range() Function
Python Examples Python Compiler ... ... The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number....
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-range-function
Python range() function - GeeksforGeeks
The range() function in Python is used to generate a sequence of integers within a specified range.
Published ย  March 10, 2026
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ range() function in python
Python range() Function - Scaler Topics
February 9, 2024 - The range() function enables users to create a sequence of numbers within a specified range. By adjusting the number of arguments provided to the function, users can determine the starting and ending points of the number sequence, as well as ...
๐ŸŒ
Stanford CS
cs.stanford.edu โ€บ people โ€บ nick โ€บ py โ€บ python-range.html
Python range() Function
The range() function can be called in a few different ways shown below (the range feature is implemented as a class, but it's simplest to think of it as a function). The most common form is range(n), given integer n returns a numeric series starting with 0 and extending up to but not including n, e.g. range(6) returns 0, 1, 2, 3, 4, 5. With Python's zero-based indexing, the contents of a string length 6, are at index numbers 0..5, so range(6) will produce exactly the index numbers for a string length 6, like this:
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ index.html
The Python Standard Library โ€” Python 3.14.4 documentation
While The Python Language Reference describes the exact syntax and semantics of the Python language, this library reference manual describes the standard library that is distributed with Python. It...
๐ŸŒ
Medium
medium.com โ€บ geekculture โ€บ python-series-the-power-of-range-function-bb0de763eb0e
Python Series: The Power of Range Function | by Mina Omobonike | Geek Culture | Medium
May 17, 2021 - range() is a built-in function of Python. By default range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number.
Find elsewhere
๐ŸŒ
Google
google.com โ€บ goto
What is the purpose of the range() function in Python? - Quora
Answer: The โ€˜range()โ€™ function in Python is used to generate a sequence of numbers within a specified range. It is commonly used in loops, particularly with the โ€˜for โ€˜ loop, to iterate over a sequence of numbers.
๐ŸŒ
docs.python.org
docs.python.org โ€บ 3 โ€บ library โ€บ functions.html
Built-in Functions โ€” Python 3.14.4 documentation
Added in version 3.2: This function was first removed in Python 3.0 and then brought back in Python 3.2. ... Return the string representing a character with the specified Unicode code point. For example, chr(97) returns the string 'a', while chr(8364) returns the string 'โ‚ฌ'. This is the inverse of ord(). The valid range ...
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ reference โ€บ datamodel.html
3. Data model โ€” Python 3.14.4 documentation
Instead, every code point in the string is represented as a string object with length 1. The built-in function ord() converts a code point from its string form to an integer in the range 0 to 0x10FFFF; chr() converts an integer in the range ...
๐ŸŒ
Google
developers.google.com โ€บ earth engine data catalog โ€บ harmonized sentinel-2 msi: multispectral instrument, level-2a (sr)
Harmonized Sentinel-2 MSI: MultiSpectral Instrument, Level-2A (SR) | Earth Engine Data Catalog | Google for Developers
/** * Function to mask clouds using the Sentinel-2 QA band * @param {ee.Image} image Sentinel-2 image * @return {ee.Image} cloud masked Sentinel-2 image */ function maskS2clouds(image) { var qa = image.select('QA60'); // Bits 10 and 11 are clouds and cirrus, respectively.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ can someone explain how range() works?
r/learnpython on Reddit: Can someone explain how range() works?
March 9, 2024 -

I've been using range() in for loops and thought range() simply returns a list, tuple or set containing a sequence of numbers. But when I tried print(x) where x = range(5), It simply gave out range(0, 5). I thought the output would be something like: [0, 1, 2, 3, 4].

My reason for thinking like that is because if I were to put a variable x (where x = range(5)) in a for loop, the for loop behaves exactly as if x = [0, 1, 2, 3, 4]. So, why does the range() behave differently if I use it outside a for loop.

I hope my question makes sense. Thank you in advance.

Edit: Thank you everyone. Your answers cleared up my confusion.

๐ŸŒ
Real Python
realpython.com โ€บ ref โ€บ builtin-types โ€บ range
range | Pythonโ€™s Built-in Data Types โ€“ Real Python
Master the Python range() function and learn how it works under the hood. You most commonly use ranges in loops.
๐ŸŒ
Google
google.com โ€บ goto
Python range() Function
The Python range() function returns an immutable sequence of numbers within the specified range. This function is used to iterate or loop through a particular code block till a given number of times.
๐ŸŒ
Codecademy
codecademy.com โ€บ docs โ€บ python โ€บ built-in functions โ€บ range()
Python | Built-in Functions | range() | Codecademy
April 28, 2025 - The range() function returns a range object, yielding numbers one by one. When you wrap it with list(), it creates a list containing all the numbers from the range. Yes, you can use range() with negative values for start, stop, or step.
๐ŸŒ
Python Land
python.land โ€บ home โ€บ language deep dives โ€บ python range() function: how-to tutorial with examples
Python range() Function: How-To Tutorial With Examples โ€ข Python Land
June 27, 2023 - There are three ways to call the range function: # With one integer argument it # counts from 0 to stop range(stop) # With two integer arguments it # counts from start to stop range(start, stop) # With three integer arguments it # counts from start to stop, # with a defined step size range(start, stop, step)Code language: Python (python)
๐ŸŒ
Pynerds
pynerds.com โ€บ python-range-function
Python range() Function
September 8, 2023 - The range() generates integers within a specified range. It is commonly used with loops especially the for loop to iterate over a sequence of numbers. ... The function returns a range object with values starting from the start to the stop(itself ...
๐ŸŒ
Better Programming
betterprogramming.pub โ€บ a-complete-guide-to-the-python-range-function-d59d5209b14
A Complete Guide to the Python Range Function | by Chaitanya Baweja | Better Programming
June 30, 2020 - Range is a built-in Python function that returns a sequence of numbers between a start integer (0 by default) and a stop integer.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-range-function-example
Python range() Function Example
March 17, 2023 - Python's built-in range() function is mainly used when working with for loops โ€“ you can use it to loop through certain blocks of code a specified number of times.
๐ŸŒ
Intellipaat
intellipaat.com โ€บ home โ€บ blog โ€บ python range() function
Python range() Function: Syntax, Examples & Use Cases
November 20, 2025 - The range() function in Python is a built-in function that generates a sequence of numbers within a specified range. You can use it to count a series one by one or to skip numbers by a step.