Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
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 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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started