Python program to convert binary to decimal using function

0
9
def binary_to_decimal(n): #Function which convert binary to decimal 
    num = n; 
    dec_value = 0; 
    base = 1;    # Initializing base
    temp = num; 
    while(temp): 
     last_digit = temp % 10; 
     temp = int(temp / 10);
     dec_value += last_digit * base; 
     base = base * 2; 
   return dec_value; 
#_____main_____
number=int(input("Please enter a number in binary: ")) 
print(binary_to_decimal(number));

   Output 1:
           Please enter a number in binary: 101
           5
   Output 2:
           Please enter a number in binary: 1110010
           114  
   Output 3:
           Please enter a number in binary: 100101011
           299

इन्हें भी देखें।

Python Programs के लिये यहाँ click करें।

 

 

 

program to convert binary to decimal using function in python write a program to convert binary to decimal using function in python write a program to convert binary to decimal using function write a python program to convert binary to decimal using function Python program to convert binary to decimal program to convert binary to decimal in python write a Python program to convert binary to decimal write a program to convert binary to decimal program to convert binary to decimal convert binary to decimal in python python program to convert binary to decimal number python program to convert binary to decimal using function python programs to convert decimal to binary write a program to convert binary number to decimal number in python python program for converting binary to decimal python program to convert binary to decimal python code for converting binary to decimal python code for converting binary to decimal using function program in python to convert binary to decimal program in python to convert binary to decimal using function convert binary to decimal program in python converting binary to decimal in python how to convert binary to decimal in python code for converting binary to decimal in python python program to convert from binary to decimal python program to convert from binary to decimal using function how to convert binary to decimal in python program program to convert decimal into binary in python wap to convert binary to decimal in python wap to convert binary to decimal using function in python write a python program to convert binary to decimal how to convert from binary to decimal in python how to convert binary number to decimal in python how to convert a binary number to decimal in python how to convert a binary to decimal in python python program to convert binary number to decimal how to convert binary numbers to decimal in python

LEAVE A REPLY

Please enter your comment!
Please enter your name here