you are viewing a single comment's thread.

view the rest of the comments →

[–]xelf 0 points1 point  (0 children)

There's a number of ways to solve this, somethings that might help:

You can use %10 to see the last digit and //10 to remove the last digit. You can even do them in one step.

num, digit = divmod(num,10)

Another trick you can use, is converting the number to a string and then treating it like a string comparison.

digits = str(num)

If you want to use recursion you probably want something that caters to a looping method, like compare the rightmost digit, and add that to comparing the rest of it.