Python Forum
Input a number with any number of digits and output it in reverse order of digits.
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Input a number with any number of digits and output it in reverse order of digits.
#7
Nitpicking the nitpicking, we are dealing with (immutable, by essence) strings here, without reverse or reversed methods. Since we need a new string to print the result anyway [::-1] is as good as it gets.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Messages In This Thread
RE: Input a number with any number of digits and output it in reverse order of digits. - by Ofnuts - Mar-12-2017, 05:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Brick Number stored as text with openpyxl CAD79 2 442 Apr-17-2024, 10:17 AM
Last Post: CAD79
  If a set element has digits in the element tester_V 3 311 Mar-25-2024, 04:43 PM
Last Post: deanhystad
  [SOLVED] Pad strings to always get three-digit number? Winfried 2 349 Jan-27-2024, 05:23 PM
Last Post: Winfried
  Prime number detector Mark17 5 811 Nov-27-2023, 12:53 PM
Last Post: deanhystad
  Create X Number of Variables and Assign Data RockBlok 8 957 Nov-14-2023, 08:46 AM
Last Post: perfringo
  find the sum of a series of values that equal a number ancorte 1 502 Oct-30-2023, 05:41 AM
Last Post: Gribouillis
  capturing multiline output for number of parameters jss 3 820 Sep-01-2023, 05:42 PM
Last Post: jss
  Sequential number for rows retrieved and storing the Primary UKey to the line number GYKR 2 581 Aug-22-2023, 10:14 AM
Last Post: GYKR
  doubling a number Skaperen 8 1,219 Jul-25-2023, 10:20 PM
Last Post: Skaperen
Question Extracting Version Number from a String britesc 2 1,095 May-31-2023, 10:20 AM
Last Post: britesc

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020