Write a function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits

28th Aug 2018, 6:43 PM
Kuldeep
Kuldeep - avatar
6 Answers
+ 4
Show us your attempts by providing what you have coded so far and we will help you.
28th Aug 2018, 6:50 PM
Steppenwolf
Steppenwolf - avatar
+ 1
print(int(input())[::-1])
28th Aug 2018, 8:29 PM
Sousou
Sousou - avatar
+ 1
Sousou function input nor the return value will be integers
28th Aug 2018, 8:33 PM
Markus Kaleton
Markus Kaleton - avatar
+ 1
check this. right code. print(int(str(input())[::-1]))
29th Aug 2018, 11:48 AM
Maninder $ingh
Maninder $ingh - avatar
0
tip: datatype change and slicing/reverse
28th Aug 2018, 6:58 PM
Markus Kaleton
Markus Kaleton - avatar
0
def rtl(num): return num[::-1] n=input() print(int(rtl(n)))
28th Aug 2018, 8:31 PM
Sousou
Sousou - avatar