title: Add numbers in hexadecimal base without converting bases?
body: <p>I need to write a function which gets two numbers in hexadecimal base, and calculates the sum of both of them, I'm not allowed to convert them to decimal base, the code is supposed to calculate it "manually" using loops.
  for example this is how it should work:</p>
  
  <pre><code> 1
   1 f 5  (A) 
  +  5 a  (B) 
  ------------- 
  = 2 4 f 
  </code></pre>
  
  <p>Here is an input example: 
  <code>&gt;&gt;&gt; add("a5", "17")</code>
  'bc' </p>
  
  <p>I've started building my code but I got stuck, I thought I would divide into three ifs, one that would sum up only numbers, other sums numbers and letters, and the third one sums letters, but I don't know how to continue from here:</p>
  
  <pre><code>def add_hex(A,B):
  lstA = [int(l) for l in str(A)]
  lstB = [int(l) for l in str(B)]
  
  if len(A)&gt;len(B):
      A=B
      B=A
  A='0'*(len(B)-len(A))+A
  remainder=False
  result=''
  for i in range(len(B)-1)
  if (A[i]&gt;0 and A[i]&lt;10) and (B[i]&gt;0 and B[i]&lt;10):
     A[i]+B[i]=result
     if A[i]+B[i]&gt;10:
         result+='1'
  </code></pre>
  
  <p>Any help is greatly appreciated, I have no clue how to start on this!</p>