summaryrefslogtreecommitdiff
path: root/progs/a387.py
blob: 1d36bf4bbb44dff654dbb3db5451676e2b04f606 (plain)
1
2
3
4
5
6
7
8
9
def binary_to_decimal(binary): 
    binary1 = binary 
    decimal, i, n = 0, 0, 0
    while(binary != 0): 
        dec = binary % 10
        decimal = decimal + dec * pow(2, i) 
        binary = binary//10
        i += 1
    return (decimal)