recently i encountered an interview question whose description was as below the number 89 is the first integer with more than one digit whose digits when raised up to consecutive powers give the same number for example 89 81 92 gives the number 89 the next number after 89 with this property is 135 11 32 53 135 write a function that returns a list of numbers with the above property the function will receive range as parameter some test cases set to 1 set to 1 parse the string into individual digits some test cases
def sum_dig_pow(low, high):
    result = []

    for number in range(low, high + 1):
        exponent = 1  
        summation = 0    
        number_as_string = str(number)

        tokens = list(map(int, number_as_string))  

        for k in tokens:
            summation = summation + (k ** exponent)
            exponent += 1

        if summation == number:
            result.append(number)
    return result



assert sum_dig_pow(1, 10) == [1, 2, 3, 4, 5, 6, 7, 8, 9]
assert sum_dig_pow(1, 100) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 89]