Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

change the order of numbers from the back

they need to order with a problem

so I have the text in a certain order of numbers, something like gematria

input [12345] is what we call gematria and what do they need?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

they need to line up the digits backwards

[54321]
have a different count and I would need help with that rather than doing twenty different if

def shiftall(s, n):
     n %= len(s)
     return s[n:] + s[:n]

it didn’t help me much it only moves the simple text

>Solution :

For strings:

return s[::-1]

For integers:

return str(s)[::-1]

Note: This would go inside def shiftall(s, n):
Additional note: Now you don’t even need the parameter n

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading