Ad
Code
Diff
  • def reverse(intOrStr):
        return intOrStr[::-1] if repr(intOrStr)[0] == "'" else int(str(intOrStr)[::-1])
    • def reverse(intOrStr):
    • reversed = ''
    • ss = ''
    • if str(intOrStr) == intOrStr:
    • for i in range(len(intOrStr)):
    • reversed += intOrStr[len(intOrStr)-i-1]
    • return reversed
    • else:
    • ss = str(intOrStr)
    • for i in range(len(ss)):
    • reversed += ss[len(ss)-i-1]
    • return int(reversed)
    • return intOrStr[::-1] if repr(intOrStr)[0] == "'" else int(str(intOrStr)[::-1])