@virnuls/

Binary to Denary

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
denary = 0
binary = input("Give me a binary number: ")
for bit in range(len(binary)):
  denary += int(binary[bit]) * 2**(len(binary)-1-bit)
print(denary)