filmov
tv
Write A Python Program To Convert Binary Number To Decimal Number

Показать описание
Hey Guys, In this video I tried to explain how to Write A Python Program To Convert Binary Number To Decimal Number
Python Scripts
======================
Python Functions Solved
==========================
Python Programs Solved
============================
Code
===========
binary = int(input("Enter binary number : "))
decimal, index = 0, 0
while binary != 0:
last_digit = binary % 10
decimal += last_digit * pow(2, index)
binary = binary // 10
index = index + 1
print("Decimal Equivalent is : ", decimal)
Keywords
=============
Python Scripts
======================
Python Functions Solved
==========================
Python Programs Solved
============================
Code
===========
binary = int(input("Enter binary number : "))
decimal, index = 0, 0
while binary != 0:
last_digit = binary % 10
decimal += last_digit * pow(2, index)
binary = binary // 10
index = index + 1
print("Decimal Equivalent is : ", decimal)
Keywords
=============