title: Converting a letter to a digit for phone number in Python
body: <p>I'm trying to write a program that prompts the user to enter a phone number as a string. The input can contain letters, and the program translates a letter (whether uppercase or lowercase) to a digit and leaves all other characters intact. Here's what I have so far:</p>
  
  <pre><code>def getNumber(uppercaseLetter):
      if uppercaseLetter == 'A':
          number = 2
      elif uppercaseLetter == 'B':
          number = 2
      elif uppercaseLetter == 'C':
          number = 2
      elif uppercaseLetter == 'D':
          number = 3
      elif uppercaseLetter == 'E':
          number = 3
      elif uppercaseLetter == 'F':
          number = 3
      elif uppercaseLetter == 'G':
          number = 4
      elif uppercaseLetter == 'H':
          number = 4
      elif uppercaseLetter == 'I':
          number = 4
      elif uppercaseLetter == 'J':
          number = 5
      elif uppercaseLetter == 'K':
          number = 5
      elif uppercaseLetter == 'L':
          number = 5
      elif uppercaseLetter == 'M':
          number = 6
      elif uppercaseLetter == 'N':
          number = 6
      elif uppercaseLetter == 'O':
          number = 6
      elif uppercaseLetter == 'P':
          number = 7
      elif uppercaseLetter == 'Q':
          number = 7
      elif uppercaseLetter == 'R':
          number = 7
      elif uppercaseLetter == 'S':
          number = 7
      elif uppercaseLetter == 'T':
          number = 8
      elif uppercaseLetter == 'U':
          number = 8
      elif uppercaseLetter == 'V':
          number = 8
      elif uppercaseLetter == 'W':
          number = 9
      elif uppercaseLetter == 'X':
          number = 9
      elif uppercaseLetter == 'Y':
          number = 9
      elif uppercaseLetter == 'Z':
          number = 9
      return number
  
  def translateNumber():
      phoneNumber = str(input("Enter a string: "))
      for char in phoneNumber:
          if char in    ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']:
          getNumber(char)
          return char
          else:
              return char
          print(phoneNumber)
  </code></pre>
  
  <p>For some reason I can't get it to work, and I'm unsure what the issue is. Can someone please help me with the solution? Thank you!</p>