Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python Code to Convert Binary to Decimal Without Inbuilt Function

Python Code to Convert Binary to Decimal Without Inbuilt Function
binary_str = input('Enter a Binary number to convert it to Decimal: ')

digit_list = list(binary_str)
digit_list.reverse()
sum = 0

for digit in (range(len(digit_list))):
    sum = sum + int(digit_list[digit]) * pow(2, digit)
print(sum)
Source by codinggear.blog #
 
PREVIOUS NEXT
Tagged: #Python #Code #Convert #Binary #Decimal #Without #Inbuilt #Function
ADD COMMENT
Topic
Name
7+1 =