title: how to convert binary to decimal using python without using the bin function
body: <p>iv made a decimal to binary converter but I need a binary to decimal converter without using the bin function and that looks simple enough to fit with this code. can anyone help? </p>
  
  <pre><code>choice=input('Please enter b for a binary to decimal conversion or d for a decimal to binary conversion:\n')
  if choice == 'd':
  decimalNum=int(input('Please enter a decimal number:\n'))
  
  bit8=0
  bit7=0
  bit6=0
  bit5=0
  bit4=0
  bit3=0
  bit2=0
  bit1=0
  bit8=decimalNum%2
  decimalNum=decimalNum//2
  bit7=decimalNum%2
  decimalNum=decimalNum//2
  bit6=decimalNum%2
  decimalNum=decimalNum//2
  bit5=decimalNum%2
  decimalNum=decimalNum//2
  bit4=decimalNum%2
  decimalNum=decimalNum//2
  bit3=decimalNum%2
  decimalNum=decimalNum//2
  bit2=decimalNum%2
  decimalNum=decimalNum//2
  bit1=decimalNum%2
  decimalNum=decimalNum//2
  
  print(str(bit1)+str(bit2)+str(bit3)+str(bit4)+str(bit5)+str(bit6)+str(bit7)+str(bit7))
  </code></pre>