title: numerology .. how to shorten code..?
body: <p>I have written this code for finding the numerological value of a name. Is there any way in which i can shorten the code, or nest one loop inside the other?</p>
  
  <pre><code>alphabets = {"A":1,"I":1,"J":1, "Q":1,"Y":1,"B":2,"K":2,"R":3,"C":3,"G":3,"L":3,"S":3,"D":4,"M":4,"T":4,"H":5,"E":5,"N":5,"X":5,"U":6,"V":6,"W":6,"O":7, "Z":7,"P":8,"F":8}
  
  word =input("your numerology score is :") #since i am using python 3 to code this
  
  def digit_sum(n):
      #prepare a list of numbers in n convert to string and reconvert
      numbers=[]
      for digit in str(n):
          numbers.append(int(digit))
      # add up the total of numbers    
      total=0
      for number in numbers:
          total += number
      return total  
  
  def numerology(word):
          total = 0
          for letter in word.upper():
              total += alphabets[letter]
              total = digit_sum(total)
  
          return total
  
  print (numerology(word))
  </code></pre>
  
  <p>To understand what is meant by numerological value, please see <a href="https://en.wikipedia.org/wiki/Numerology#Latin_alphabet_systems" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Numerology#Latin_alphabet_systems</a>. </p>