Enter an integer and base, convert to decimal output
Input format:
Enter integer and base on one line
Output format:
output the result in one line in decimal
Sample input:
A set of inputs is given here. E.g:
45,8
Sample output:
The corresponding output is given here. E.g:
37
a,b=input().split(",",1)
b=eval(b)
c=int(a,b)
print(c)
Write conversion function yourself
a,b = input().split(",",1)
a=str(a)
b=int(b)
count=len(a)
i=0
sum=0
while count !=0 :
sum += int(a[i])*(b**(count-1))
count -= 1
i += 1
print(sum)