Ad

The function 'reverse' takes one parameter. Return the reversed parameter.

The parameter can be either an int or a string, and your return must be of the same type as the input.

reverse(1234) --> 4321
reverse('absfe') --> 'efsba'

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)