I need to convert a binary input into a decimal integer. I know how to go from a decimal to a binary:
n = int(raw_input(\'enter a number: \')) print \'{0:b}\'.fo
The input may be string or integer.
num = 1000 #or num = '1000' sum(map(lambda x: x[1]*(2**x[0]), enumerate(map(int, str(num))[::-1]))) # 8