title: Python: Invalid Literal for Int() Base 10
body: <p>I'm writing code for a project to determine the validity of credit cards and i've hit a wall, it seems like all of the things i have tried so far are not working.</p>
  
  <p>This is giving me an error for the sumofodds function where j=int(card[i])</p>
  
  <p>The error is "Invalid Literal for Int() with Base 10</p>
  
  <p>Is there anyone that can give me some advce?</p>
  
  <pre><code>def sumofdoubles():
      card=input()
      x=len(card)
      summ=0
  
      for i in range(x-2,-1,-2):
          j=int(card[i])
          u=j+j
  
          if u&gt;9:
              h=u/2
              summ=summ+h
  
       return(summ)
  
  def sumofevens():
      card=input()
      x=len(card)
      summ=0
  
      for i in range(x-2,-1,-2):
          j=int(card[i])
          u=j+j
          if u&lt;9:
              summ=summ+u
  
      return(summ)
  
  
  def sumofodds():
      summ=0
      card=input()
      x=len(card)
  
      for i in range(x-1,-1,-2):
          j=int(card[i])
          summ=summ+j
  
      return(summ)
  
  def main():
      card=input()
      length=len(card)
      summ=0
  
      while(card!="#####"):
          if (card[0]=='4' or card[0]=='5' or card[0]=='6' or (card[0]=='3' and      card[1]=='1')):
              dbls=sumofdoubles()
              evens=sumofevens()
              odds=sumofodds()
              if((dbls+evens+odds)%10==0):
                  print("Valid")
  
  main()
  </code></pre>
  
  <p>This is the full traceback for those wondering</p>
  
  <pre><code>    python test.py&lt;s.input
      File "test.py", line 52 in &lt;module&gt;
        main()
      File "test.py", line 48, in main
        odds=sumofodds()
      File "test.py", line 33, in sumofodds
        j=int(card[i])
  ValueError: invalid literal for int() with base 10: '#'
  </code></pre>