Konversikan basis apa pun menjadi ular piton desimal

n = int(input());
b = int(input());

def AnyToDec(n,b):
    # Write your code here
    p=1
    res = 0
    while(n>0):
        rem = n%10
        n = int(n/10)
        res = res + p*rem
        p = p * b
    return res    

if __name__ == "__main__":
    res = AnyToDec(n,b)
    print(res)
Combative Cardinal