Hey If you are beginner and want to learn a python then you are on right path. Learn basic as well as advanced programming in Python.

Search

Python program to convert the binary number to the decimal number using class in Python.

PYHTON PROGRAM





def Decimal(n):

d=0

base=1

num=n

while(n>0):

rem=n %10

d=d+ rem * base

n=n//10 

base=base * 2

print ("Decimal number of",num,"is:\n",d)


Decimal(1111)

Decimal(1000)

Decimal(10001100)

Decimal(100)

Decimal(111)

Decimal(1011)

Decimal(10)

Decimal(1001)





*** Input && Output ***







No comments:

Post a Comment

let me know which type examples you want to comment me.