Just for fun.......... Is there anyone with another idea?

Just for fun, probably very inefficient :sweat_smile: without using the int() class with base

def base_2_10(value):
    str_value = list(reversed(list(str(value))))
    transformed = 0
    for val, exponent in zip(str_value, range(len(str_value))):
        transformed += int(val)*(2**exponent)
    return transformed

decimal_1 = base_2_10(11001)

decimal_2 = base_2_10(1110)
1 Like
def base_2_10(value):
# digit of values in a list from right to left
    digits = [int(value/10**i)% 10 for i in range(len(str(value)))]
    return sum([2**power*digits[power] for power in range(len(digits))])

I’ll definitely win in the ugly code department