Numbers and arithmetic · Python exercise
Reverse a non-negative integer without printing leading zeros.
Read a non-negative integer and print it with its digits reversed. Leading zeros are dropped, so 1200 becomes 21.
Example 1
Input
1234
Output
4321
Example 2
Input
1200
Output
21
Leading zeros are not shown.
How testing works
Your code runs once per test case with that case's standard input. Output is compared after normalising trailing spaces and blank lines at the end. Use input() without a prompt when the exercise expects clean output.
Loading editor…
Press Run tests to execute your code against every input case. Python runs in a Web Worker in your browser.