I want to write a simple function that prints the digits of an integer in reverse.
I think it could be done with the while loop, but I am not so sure.
I have tried this, but it didn't work.
I think it could be done with the while loop, but I am not so sure.
I have tried this, but it didn't work.
Code:
def print_digits(n): n = abs(n) while n > 0: n = n % 10 print n,
Comment