Question: 
Write a function to convert the given binary number to its decimal equivalent.


Model's Code:
def binary_to_decimal(binary):
    return int(str(binary), 2)



Sample Correct Code:
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)


Asserts:
assert binary_to_decimal(100) == 4
assert binary_to_decimal(1011) == 11
assert binary_to_decimal(1101101) == 109


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 24 of 974: 18/24 (75.0%): success