title: number system converter python
body: <p>Hi I want to make my own number converter that converts an input of binary, octal or hexadecimal to the corresponding decimal value. </p>
  
  <p>I have to use 2 separate functions, the first to convert the alphabetical digits to numerical values then the second to convert the result of that by using the input base to be converted to a decimal value...</p>
  
  <pre><code>   def hexConvert (x):
      return int(x, base)
  
  x = str(input("input value to convert to decimal: "))
  base = int(input("Base of value to be converted to decimal: "))
  print(x, " in base ", base, " = ", hexConvert(x), " in decimal")
  </code></pre>
  
  <p>I know this works very well and is robust. I want to learn how to use more python functions by doing it manually.</p>
  
  <p>This is what I currently have:</p>
  
  <pre><code>    number = (input("Enter value to be converted to decimal: "))
  base = int(input("Enter the base of the value: "))
  
  for index in number:
      print(index)
  def hexConvert(number, base):
      for number &gt; 0:
          if number == 1:
              return 1
          if number == 2:
              return 2
          if number == 3:
              return 3
          if number == 4:
              return 4
          if number == 5:
              return 5
          if number == 6:
              return 6
          if number == "7":
              return 7
          if number == "8":
              return 8
          if number == "9":
              return 9
          if number == "A":
              return 10
          if number == "B":
              return 11
          if number == "C":
              return 12
          if number == "D":
              return 13
          if number == "E":
              return  14
          elif number == "F":
              return 15
          else:
              print(number)
  
  
  nString = ""
  def deciConvert(number, base):
      number = int(number)
      while number &gt; 0:
          bString = number%base
          nString = nString + str(bString)
          number = number // base
  
  print(deciConvert(number, base))
  </code></pre>
  
  <p>I've lost myself at this point, I think I haven't started any calculations yet, I would really appreciate any 2nd opinions.
  Thank you!        </p>