Exercise: Reverse digits
"Reverse an integer" shows up in phone screens. In many languages it is about overflow. In Python, ints have no limit, so the question becomes about handling the sign and the zeros cleanly.
Exercise: finish reverse_digits. It returns the integer with its digits
reversed and the sign kept. 123 gives 321, -450 gives -54, and 0
gives 0.
Hint: str, slicing, int and abs are enough. No loop needed. Leading
zeros take care of themselves, because int("054") is 54.
Press Check to run the tests.