Issue
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?
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
Answered By - Ryan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.