title: Writing a function in Python 3 to convert base 16 to base 10
body: <p>Is there an easy way to modify this code which converts from base 2 into base 10 to work for converting base 16 into base 10? My objective is to build a dedicated function for conversion and not use any built-in Python features for the calculation. Thanks</p>
  
  <pre><code>BinaryVal = int(input('Enter:')
  DecVal = 0
  for n in range(len(str(BinaryVal))):
      Power = len(str(BinX))-(n+1)
      DecVal += int(str(BinaryVal)[n])*(2**Power)
  print(DecVal)
  </code></pre>