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
🌐
Programiz
programiz.com › python-programming › examples › reverse-a-number
Python Program to Reverse a Number
To understand this example, you should have the knowledge of the following Python programming topics: ... num = 1234 reversed_num = 0 while num != 0: digit = num % 10 reversed_num = reversed_num * 10 + digit num //= 10 print("Reversed Number: " + str(reversed_num)) ... First, the remainder of the num divided by 10 is stored in the variable digit.
Discussions

How to reverse a given number in python using just for loop - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
Is there a way to reverse a for loop
The reversed() function might be what you're looking for. Return a reverse iterator. seq must be an object which has a __reversed__() method or supports the sequence protocol (the __len__() method and the __getitem__() method with integer arguments starting at 0). ie for i in reversed(range(1, 101)): print(i) output: 100 99 98 97 96 ... 5 4 3 2 1 More on reddit.com
🌐 r/learnpython
4
1
March 27, 2020
Reversing a range using a FOR LOOP
You should show what you've tried so far. It's easier to give productive help if we base the help on code you've written. It doesn't require a for-loop though. You can use one, but it would be far more straightforward with a while. Be careful of artificially limiting what tools you consider. More on reddit.com
🌐 r/learnpython
11
0
December 24, 2022
python - How to for loop in reverse? - Stack Overflow
I'm making a water simulation program, and I need it to do a for loop through y, x. But I need it to check the most bottom y first, then up. This is my lvl: lvl = [[0, 0, 1, 0, 0], [0, 0, 1... More on stackoverflow.com
🌐 stackoverflow.com
June 9, 2012
🌐
Python Morsels
pythonmorsels.com › looping-in-reverse
Looping in reverse - Python Morsels
May 27, 2025 - To loop in the reverse direction, you can use Python's built-in reversed function: >>> colors = ["purple", "blue", "green", "pink", "red"] >>> for color in reversed(colors): ... print("I like", color) ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › backward-iteration-in-python
Backward iteration in Python - GeeksforGeeks
July 11, 2025 - a = [10, 20, 30, 40, 50] #Loop through the list #using reversed() to reverse the order of list for b in reversed(a): print(b) ... Let's explore more methods that helps to iterate backward on any iterable. Here are some common approaches: ... range function is provided with three arguments(N, -1, -1). Use this method when we need to modify elements or access their indices. ... 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])
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-program-to-reverse-a-number
Python Program to Reverse a Number - GeeksforGeeks
November 18, 2025 - ... This method converts the number to a string and reverses it by iterating through its characters. ... Explanation: The loop adds each character at the beginning of rev, forming the reversed order.
🌐
CodeScracker
codescracker.com › python › program › python-program-find-reverse-of-number.htm
Python Program to Reverse a Number
Note - The statements inside for loop gets executed x number of times. The value of x indicates the total digit of given number. Now this program uses list to reverse a given number.
🌐
Stack Overflow
stackoverflow.com › questions › 65640864 › how-to-reverse-a-given-number-in-python-using-just-for-loop
How to reverse a given number in python using just for loop - Stack Overflow
i did it in while loop but couldn't do it in for loop ... Save this answer. ... Show activity on this post. In your example your using arithmetic, but why not convert to a string to make life easier? x = int(input("enter a number: ")) result = "" for char in str(x)[::-1]: result += char print(result) Note that [::-1] means "iterate backwards" and that if your number ends with zeros, they'll appear at the start of the reversed string.
Find elsewhere
🌐
Newtum
blog.newtum.com › reverse-a-number-in-python-using-for-loop
Reverse a Number in Python Using For Loop - Newtum
October 14, 2024 - After the for loop completes, the reversed number is stored in the reverse variable. Using the print() function we display the reversed number concatenated with the string ‘The reverse number is =’. Check out our blog on Reverse a Number in Python Using String Slicing here! Enter the first number:12356 The reverse number is = 65321 · In this example, the user enters the number 12345. The program then reverses the digits of the number using a for loop.
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python for loop in backwards
Python For Loop in Backwards - Spark By {Examples}
May 31, 2024 - How to print Python for loop in backwards? you can use reversed() functions to implement the loop from backward direction. Usually, Python for loop is
🌐
Tutorial Gateway
tutorialgateway.org › python-program-to-reverse-a-number
Python Program to Reverse a Number
April 7, 2025 - This program uses the for loop range to iterate digits in a number and reverse them.
🌐
Quora
quora.com › How-do-I-write-a-program-in-Python-using-a-for-loop-by-the-reverse-indexing-method
How to write a program in Python using a for loop by the reverse indexing method - Quora
Answer (1 of 2): Upon doing a quick search, the reverse indexing method involves iterating through a group of stored values or string in reverse order. In other words, we begin from the end of the list or string until we reach its first value. Let's attempt to do this, with a list and a string...
🌐
wikiHow
wikihow.tech › computers and electronics › software › programming › python › 6 ways to reverse a string in python: easy guide + examples
6 Ways to Reverse a String in Python: Easy Guide + Examples
March 20, 2023 - Alternatively, use a For loop or the reversed() function for additional flexibility in the reversal process. You can also use the join() function or a list to make a string backwards.
🌐
JanBask Training
janbasktraining.com › community › python-python › how-do-i-reverse-a-list-or-loop-over-it-backwards
How do I reverse a list or loop over it backwards? | JanBask Training Community
June 4, 2025 - Python offers built-in features that make this process clean and readable. ... The reversed() function returns an iterator that yields the elements of the list in reverse order. my_list = [1, 2, 3, 4, 5] for item in reversed(my_list): print(item)
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-reverse-string
Python Reverse String - 5 Ways and the Best One | DigitalOcean
August 3, 2022 - Python String doesn’t have a built-in reverse() function. However, there are various ways to reverse a string in Python. ... Using Slicing to create a reverse copy of the string. Using for loop and appending characters in reverse order
🌐
Tutorial Gateway
tutorialgateway.org › python-program-to-reverse-string
Python Program to Reverse a String
January 4, 2026 - Within the loop, we add each character to the starting position and push the existing one to the next position. For example, st1 = Hello. In the first iteration, st2 is H. In the second iteration, e is placed in the first position, and H pushes ...
🌐
TutorialsPoint
tutorialspoint.com › article › backward-iteration-in-python
Backward iteration in Python
Python provides three common approaches: range() with negative step, slice notation [::-1], and the reversed() built-in function. Start from the last index and step backwards by -1 until index 0 ? days = ['Mon', 'Tue', 'Wed', 'Thu'] for i in ...
🌐
GUVI
guvi.in › blog › python › python reverse string: 7 effective ways with examples
Python Reverse String: 7 Effective Ways with Examples
January 8, 2026 - In this example, the reverse_string function takes an input string, applies the reversed() function to create an iterator, and then uses "".join() to form the reversed string. This method is straightforward and leverages Python’s powerful built-in functions to perform the task efficiently. By understanding and utilizing these techniques, you can effectively reverse strings in Python, enhancing both the readability and performance of your code. Reversing strings using loops in Python is a straightforward method that can be accomplished either through a for loop or a while loop.