About 98,900 results
Open links in new tab
  1. How to reverse an int in python? - Stack Overflow

    Jul 25, 2014 · def reverse(num): rev = 0 while(num != 0): reminder = num % 10 rev = (rev * 10 ) + reminder num = num // 10 print ("Reverse number is : " , rev ) num=input("enter number : ") …

  2. How do I reverse a string in Python? - Stack Overflow

    May 31, 2009 · Python has a special circumstance to be aware of: a string is an iterable type. One rationale for excluding a string.reverse() method is to give python developers incentive to …

  3. Reversing bits of Python integer - Stack Overflow

    Given a decimal integer (eg. 65), how does one reverse the underlying bits in Python? i.e.. the following operation: 65 → 01000001 → 10000010 → 130 It seems that this task can be broken …

  4. if statement - Reverse number in Python - Stack Overflow

    Mar 26, 2022 · Reverse number in Python. Ask Question Asked 2 years, 11 months ago. Modified 2 years, 11 months ago ...

  5. python - How do I reverse a list or loop over it backwards? - Stack ...

    Oct 15, 2010 · I find (contrary to some other suggestions) that l.reverse() is by far the fastest way to reverse a long list in Python 3 and 2. I'd be interested to know if others can replicate these …

  6. python - Print a list in reverse order with range ... - Stack Overflow

    Sep 2, 2011 · $ python -m timeit "[9-i for i in range(10)]" 1000000 loops, best of 3: 1.54 usec per loop martineau's answer (readable if you are familiar with the extended slices syntax): $ …

  7. Python reverse integer using recursion - Stack Overflow

    Oct 21, 2019 · I am working on a problem that need to reverse a integer input without using list or string. But my program only return first and last digits. def reverseDisplay(number): if …

  8. python - Print reverse of a number - Stack Overflow

    Jun 28, 2016 · The reverse() function creates an array, adds each digit from the input to said array, and then prints it as plain text. If you want the data from that as an integer then you can …

  9. Slick way to reverse the (binary) digits of a number in Python?

    For example if you reverse the bits of the integer 1 you want 1 as the result, but C programmers are generally going to want either 2^15 or 2^31 according to how many bits there are in …

  10. Python reverse() for palindromes - Stack Overflow

    Dec 19, 2016 · Try this code to find whether original & reverse are same or not:- if a == a[::-1]: #this will reverse the given string, eventually will give you idea if the given string is palindrome …

Refresh