Question: Prob. 4 Develop a function that reverses digits of any given integer. i def reverse_digits (num): The input num should be an integer , if

 Prob. 4 Develop a function that reverses digits of any given

Prob. 4 Develop a function that reverses digits of any given integer. i def reverse_digits (num): The input num should be an integer , if not, raise an exception and return with some instructive message to input int type data. When coded correctly, reverse-digits (12345) and reverse-digits (+12345) should return '54321', and reverse_digits (-12345) should return '-54321'. That is, besides reversion of digits, the signs need some addition attention. To avoid complication caused by int ( removing leading O's, such as int (0001)=1, you should return the reversed digits as a string. Finish the reverse_digits.py code to solve this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!