human
Program for Binary To Decimal Conversion | Function to convert binary to decimal.
Initializing base value to 1 , i . e 2 ^ 0.
Driver Code"
Solution in Python:
 ... What is a code to program for Binary To Decimal Conversion and the other steps required?
assistant
#Here is code to program for Binary To Decimal Conversion and the other steps required.
 def binaryToDecimal ( n ) :
	num = n ;
	dec_value = 0 ;
	base = 1 ;
	temp = num ;
	while ( temp ) :
		last_digit = temp % 10 ;
		temp = int ( temp / 10 ) ;
		dec_value += last_digit * base ;
		base = base * 2 ;
	return dec_value ;
num = 10101001 ;
print ( binaryToDecimal ( num ) ) ;