range() and xrange() take a third parameter that specifies a step. So you can do the following.

range(10, 0, -1)

Which gives

[10, 9, 8, 7, 6, 5, 4, 3, 2, 1] 

But for iteration, you should really be using xrange instead. So,

xrange(10, 0, -1)

Note for Python 3 users: There are no separate range and xrange functions in Python 3, there is just range, which follows the design of Python 2's xrange.

Answer from Chinmay Kanchi on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › backward-iteration-in-python
Backward iteration in Python - GeeksforGeeks
July 11, 2025 - s = "Python" # - len(s) - 1: Start at the last index # - -1: Ensures the loop stops after the first character # - -1: The step value to iterate backwards for i in range(len(s) - 1, -1, -1): print(s[i]) ... We can use slicing slicing notation [::-1] ...
Discussions

bash - How do I reverse a for loop? - Unix & Linux Stack Exchange
How do I properly do a for loop in reverse order? for f in /var/logs/foo*.log; do bar "$f" done I need a solution that doesn't break for funky characters in the file names. More on unix.stackexchange.com
🌐 unix.stackexchange.com
For Loop Backwards Help
For Loop Backwards Help. Learn more about for loop, loop, basic, math, simple, question, for MATLAB More on mathworks.com
🌐 mathworks.com
1
0
February 7, 2016
Reverse For Loop for Components
Hello there, Update: To anyone with the same problem, you must use a Reverse For Loop to make this work: [A Little Tip] Remove elements from an array in one pass with a reverse for loop - Programming & Scripting - Unreal Engine Forums I appreciate any kind of help! More on forums.unrealengine.com
🌐 forums.unrealengine.com
1
0
September 28, 2016
Reverse Iteration Terminal in For Loop - NI Community
It has been a few months since a suggestion has been made to do something about the For Loop, so if nothing else it is time to stir things up a little bit. There have been several suggestions to do something with the iterators, for example: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Smart-Iter... More on forums.ni.com
🌐 forums.ni.com
August 18, 2010
🌐
Reddit
reddit.com › r/zig › is there a proper way to do a reverse for loop?
r/Zig on Reddit: Is there a proper way to do a reverse for loop?
May 29, 2023 -

I'm not finding much about doing a reversed for loop on a slice. Something with this kind of code:

const string: []const u8 = "1234";
for reversed (string) |character| {
    std.debug.print("{}", .{character});
}

And this output:

4
3
2
1

Is there a language feature I'm not aware of, or a function in the std, or should I just use a plain old dirty while loop?

🌐
Medium
travcav.medium.com › why-reverse-loops-are-faster-a09d65473006
A look at reverse loops
June 19, 2017 - Putting a number on the stack isn’t so bad but if you’re looping through a few hundred thousand elements then that’s a few hundred thousand times it has to put that number on the stack or whatever functionality you put there. Sure a few hundred thousand extra instructions probably isn’t the worst thing in the world, but if you put a function there that takes an extra millisecond then you’ve just added minutes to your code. And hey if you’re bothering to use a reverse For Loop then you care about those cycles.
🌐
AlgoCademy
algocademy.com › link
Looping In Reverse in Java | AlgoCademy
In this lesson, we covered how to use a for loop to count backwards in Java. We discussed the basic concepts, provided examples, and highlighted common pitfalls and best practices. Mastering reverse loops is essential for writing efficient and readable code.
🌐
Fluent C++
fluentcpp.com › home › reverse for loops in c++
Reverse For Loops in C++ - Fluent C++
January 30, 2020 - Let’s see how to traverse a collection backwards by using a range for loop. C++20 will bring ranges to the language, including a range adaptor called std::ranges::views::reverse, or std::views::reverse.
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › how-to-reverse-an-array-in-javascript-js-reverse-function
How to Reverse an Array in JavaScript – JS .reverse() Function
November 29, 2022 - By Dillion Megida In this article, I'll show you two ways to reverse arrays in JavaScript. The reverse method of arrays reverses an array by making the last item the first, and making the first item the last. The other items in between also ...
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python for loop in backwards
Python For Loop in Backwards - Spark By {Examples}
May 31, 2024 - Following are the examples of for loop in backwards # Example 1: Get the loop iteration in Backwards # Using reversed() print("Get the loop in backwards") for i in reversed(range(1,6)): # Example 2: Get the for loop in backwards using range() print("Get the loop in backwards") for i in range(6, 0, -1): # Example 3: Get the for loop in backwards using range() & len() # Initialize the list list=[10, 20, 50, 30, 40, 80, 60] print("Get the loop in backwards") for i in range(len(list) -1, -1, -1): # Example 4: Get the loop iterations in Backwards # using slicing list=[10, 20, 50, 30, 40, 80, 60] for i in list[-1::-3]: # Example 5: Get the for loop index in backwards using range() & len() # Initialize the list list=[10, 20, 50, 30, 40, 80, 60] print("Get the loop index in backwards") for i in range(len(list) -1, -1, -1): # Example 6: Get the index and items of list in backward direction.
🌐
Unreal Engine
forums.unrealengine.com › development › programming & scripting › blueprint
Reverse For Loop for Components - Blueprint - Epic Developer Community Forums
September 28, 2016 - Hello there, Update: To anyone with the same problem, you must use a Reverse For Loop to make this work: [A Little Tip] Remove elements from an array in one pass with a reverse for loop - Programming & Scripting - Unr…
🌐
W3Schools
w3schools.com › php › php_looping_for.asp
PHP for loop
$x <= 10;, is evaluated before each iteration, and the loop continues if this expression evaluates to true. Here, the expression is true as long as $x is less than, or equal to 10. $x++;, is evaluated after each iteration, and it increases the counter variable $x by one. The following example shows a for loop that prints the numbers from 10 to 0, by decreasing the counter variable:
🌐
National Instruments
forums.ni.com › t5 › LabVIEW-Idea-Exchange › Reverse-Iteration-Terminal-in-For-Loop › idi-p › 1174449
Reverse Iteration Terminal in For Loop - NI Community
August 18, 2010 - My G-instincts tell me that they should be built in the order of loop cycles, my C-instincts tell me I am building array[i] and if i goes in reverse order, so should the array elements. For now I say, forget it, and just stick to the simple terminal.
🌐
AlgoCademy
algocademy.com › link
Looping In Reverse in JavaScript | AlgoCademy
This code iterates over an array in reverse order, printing each element. Here is the complete code implementation for the assignment: ... Use console.log: Print the loop variable at each iteration to verify its value.
🌐
GeeksforGeeks
geeksforgeeks.org › java › reverse-a-string-in-java
Reverse a String in Java - GeeksforGeeks
Explanation: The string is converted to bytes, reversed, and then reconstructed into a new String. For Loop: For simplicity and complete manual control over the reversal process.
Published   October 14, 2025
🌐
Mimo
mimo.org › glossary › python › for-loop
Python For Loop: Syntax and Examples [Python Tutorial]
For loops · Formatted strings · Functions · Generator · Globals() Greater than operator · Greater than or equal to operator · If statement · in operator · Indices · Inequality operator · Inheritance · Integers · Iterator · JSON · Lambda function · len() Function · Less than operator · Less than or equal to operator · List append() method · List comprehension · List count() List insert() method · List pop() method · List reverse() method ·
🌐
Loop Returns
loopreturns.com
Loop | The Operations Platform Built for Retention
Shipping streamlines reverse logistics with optimized return labels and routing, which lowers shipping costs and improves operational efficiency.Learn more ... Integrations connect your ecommerce, logistics, and support systems, which eliminates manual workflows and keeps data synchronized across teams.Learn more ... Powered by robust data from shoppers, brands, and carriers, Loop’s network helps you prevent fraud, uncover insights, and make smarter decisions automatically.
🌐
Jennerstrand
jennerstrand.se › home › reverse for loop in c# – a quick look
Reverse FOR loop in C# - A quick look - Eric Sjöström Jennerstrand
December 5, 2020 - Reverse FOR loop in C# are useful if you need to iterate a List backwards without first reversing. for (int i = list.Count - 1; i >= 0; i--)