Answer to Question #80127 in Python for somnath khanra
2018-08-24T11:24:58-04:00
Write a function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits in n.
1
2018-08-27T04:44:10-0400
def intreverse(number:int) -> int: return int(str(number)[::-1]) , where at the beginning function converts number to string, then uses string slice [::-1] which makes reverse of string and finally converts this string back to int
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
Python
Comments
Leave a comment