You can iterate a string in python, and you'll be iterating by each character

There you go:

a = input("Enter : ")
x = [num for num in a]  # Getting the individual digits
b = reversed(x)         # reversed() is a built in function
print("".join(b))
Answer from adsa 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 ...
🌐
W3Schools
w3schools.com › python › python_howto_reverse_string.asp
How to reverse a String in Python
There is no built-in function to reverse a String in Python. The fastest (and easiest?) way is to use a slice that steps backwards, -1. ... Create a slice that starts at the end of the string, and moves backwards.
Discussions

write a python program to reverse the given numbers - Stack Overflow
If your input is string so you just need to reverse it ... See other answer for great explanations. Here I add 2 simpler solutions to the original problem - how to reverse a number: # For example, 12345: num = input("Enter number: ") # fastest and shortest: rev = num[::-1] # or (slower and ... More on stackoverflow.com
🌐 stackoverflow.com
Lazy Reverse Method in O(1) Time
There is reversed(list_object). More on reddit.com
🌐 r/Python
45
27
July 7, 2024
reversed vs [::-1]
Note that reversed() doesn't return a list, it returns an iterator. Your code snippets aren't equivalent. Should programmer choose carefully between slicing and reversed? Only if you have huge lists that take up gigabytes of memory. Just choose the one that expresses your intent more clearly. More on reddit.com
🌐 r/Python
6
3
June 24, 2014
Is it just me, or is string reversing difficult/surprising?
Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython ... Yes, I realize that there are alternatives, but they are non-obvious (or at least not as obvious as str.reverse()). More on reddit.com
🌐 r/Python
97
44
July 12, 2015
🌐
Programiz
programiz.com › python-programming › methods › built-in › reversed
Python reversed()
country_capitals = { 'England': 'London', 'Canada': 'Ottawa', 'Germany': 'Berlin' } # access keys in reversed order # and convert it to a tuple country = tuple(reversed(country_capitals)) print(country)
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-program-to-reverse-a-number
Python Program to Reverse a Number - GeeksforGeeks
November 18, 2025 - This method reverses the number by converting it to a string, slicing it in reverse order and converting it back to an integer. ... This method extracts digits from the end of the number using % 10 and builds the reversed number digit-by-digit.
🌐
Toppr
toppr.com › guides › python-guide › references › methods-and-functions › methods › built-in › reversed › python-reversed
Python reversed(): reversed() Parameters, Return value from reversed()
July 29, 2021 - def rev_sentence(sentence): # First, break the string into words. words1 = sentence.split(' ') # We need to reverse the list # using the split function and join # them using the space function reverse_sentence = ' '.join(reversed(words1)) #return reverse sentence from the joined string if __name__ == "__main__": input = 'geeks quiz practice code' print (rev_sentence(input)) Output: code practice quiz geeks ... #creating the string strg1 = "I am an expert python programmer" # splitting the string on space words1 = strg1.split() # reversing the words using reversed() function ...
🌐
Medium
medium.com › @khasnobis.sanjit890 › python-reverse-string-74cc521cf8ca
Python Reverse String. Today we are going to write some code… | by Sanjit Khasnobis | Medium
September 10, 2023 - def reverseStr_slicemethod(inputStr): outputStr = inputStr[::-1] return outputStr def reverseStr_loopinglist_appendmethod(inputStr): outputStrlist = [] inputStrlist = list(inputStr) len_of_list = len(inputStrlist) for i in range(len_of_list): outputStrlist.append(inputStrlist[(len_of_list-i)-1]) outputStr = "".join(outputStrlist) return outputStr def reverseStr_reversed_method(inputStr): inputStrlist = list(inputStr) outputStrlist = reversed(inputStrlist) outputStr = "".join(outputStrlist) return outputStr def reverseStr_strconcat_method(inputStr): outputStr = '' for i in inputStr: outputStr =
Find elsewhere
🌐
Programiz
programiz.com › python-programming › methods › list › reverse
Python List reverse()
# Operating System List systems = ['Windows', 'macOS', 'Linux'] # Printing Elements in Reversed Order
🌐
GitHub
gist.github.com › hossainlab › b58bd9b22dfeb5eeedba4ee37c007946
Python Program To Reverse a Given Number - Gist - GitHub
n = int(input("Enter a number: ")) reversed_number = 0 while(n>0): last_digit = n reversed_number = reversed_number*10+last_digit n = n//10 print("The reversed number is: ",reversed_number)
🌐
Real Python
realpython.com › reverse-string-python
Reverse Strings in Python: reversed(), Slicing, and More – Real Python
July 31, 2023 - So far, you’ve learned about core Python tools and techniques to reverse strings quickly. Most of the time, they’ll be your way to go. However, you might need to reverse a string by hand at some point in your coding adventure. In this section, you’ll learn how to reverse strings using explicit loops and recursion. The final technique uses a functional programming approach with the help of Python’s reduce() function.
🌐
Vultr
docs.vultr.com › python › examples › reverse-a-number
Python Program to Reverse a Number | Vultr Docs
December 9, 2024 - ... def reverse_number_math(n): reversed_num = 0 while n > 0: reversed_num = reversed_num * 10 + n % 10 n //= 10 return reversed_num # Example usage: number = 12345 reversed_number = reverse_number_math(number) print(reversed_number) Explain Code
🌐
Toppr
toppr.com › guides › python-guide › references › methods-and-functions › python-list-reverse
reverse list Python: How to reverse a list in Python, FAQs
October 20, 2021 - To reverse a list in Python, we have a built-in function known as reverse(). The reverse() function swaps the entire list of elements in the opposite order. For example – ... Q2. How do you reverse in Python 3? Answer. Python program as a whole, be it any version accepts the reverse() function ...
🌐
PREP INSTA
prepinsta.com › home › python program › reverse a number in python
Reverse of a number in Python | PrepInsta​
July 29, 2023 - In this method we’ll use the string slicing methods to reverse the number. First we’ll convert the number into a string and then using the string slicing property in python language, we’ll slice the string to break it down and add it up in reverse order.
🌐
GUVI
guvi.in › blog › python › python reverse string: 7 effective ways with examples
Python Reverse String: 7 Effective Ways with Examples
January 8, 2026 - These examples demonstrate the flexibility of using loops to reverse strings in Python. Whether you choose a for loop for its straightforward syntax or a while loop for more control over the index, both methods provide robust solutions for string manipulation. Recursion is a powerful programming ...
🌐
W3Schools
w3schools.com › python › ref_func_reversed.asp
Python reversed() Function
Built-in Modules Random Module Requests Module Statistics Module Math Module cMath Module · Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python ...
🌐
Tutorial Gateway
tutorialgateway.org › python-program-to-reverse-a-number
Python Program to Reverse a Number
April 7, 2025 - Next, Condition in the Python While loop ensures that the given number is greater than 0. From the above Python example program, the User Entered integer value: Number = 1456 and Reverse = 0
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-reversed-function
Python reversed() Method - GeeksforGeeks
February 17, 2026 - It works with sequence types like lists, tuples, strings and ranges or any object that implements the __reversed__() method. Example: In this example, a list is reversed using reversed() and converted into a list for display.
🌐
Mimo
mimo.org › glossary › python › list-reverse-method
Python List reverse() Method: Syntax, Methods, and Examples
Learn how to reverse a list in Python using slicing, reverse(), reversed(), and loops. Compare methods, use cases, and performance best practices.
🌐
Unstop
unstop.com › home › blog › how to reverse a string in python in 10 ways! (code)
How To Reverse A String In Python In 10 Ways! (Code)
December 21, 2023 - Given below is its syntax, followed by a proper code example with an explanation. ... The result of this slicing operation is a new string (reversed_string) that contains the characters of the original string in reverse order. ... b3JpZ2luYWxfc3RyaW5nID0gIkhlbGxvLCBXb3JsZCEiDQpyZXZlcnNlZF9zdHJpbmcgPSBvcmlnaW5hbF9zdHJpbmdbOjotMV0NCg0KcHJpbnQoIk9yaWdpbmFsIFN0cmluZzoiLCBvcmlnaW5hbF9zdHJpbmcpDQpwcmludCgiUmV2ZXJzZWQgU3RyaW5nOiIsIHJldmVyc2VkX3N0cmluZyk= ... The sample Python program above begins with the declaration of a variable original_string.
🌐
W3Schools
w3schools.com › python › ref_list_reverse.asp
Python List reverse() Method
Built-in Modules Random Module Requests Module Statistics Module Math Module cMath Module · Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python ...