phoneNum
  1. phoneNum = input("Enter the number in the format of XXX-XXX-XXXX: ")
  2.  
  3. phoneNum= phoneNum.split('-')
  4.  
  5. for var in phoneNum[1:2]:
  6.       for char in phoneNum:
  7.             if char == 'A' or char == 'B' or char == 'C':
  8.                   char == '2'
  9.             elif char == 'D' or char == 'E' or char == 'F':
  10.                   char = '3'
  11.             elif char == 'G' or char == 'H' or char == 'I':
  12.                   char = '4'
  13.             elif char == 'J' or char == 'K' or char == 'L':
  14.                   char = '5'
  15.             elif char == 'M' or char == 'N' or char == 'O':
  16.                   char = '6'
  17.             elif char == 'P' or char == 'Q' or char == 'R' or char == 'S':
  18.                   char = '7'
  19.             elif char == 'T' or char == 'U' or char == 'V':
  20.                   char = '8'
  21.             elif char == 'W' or char == 'X' or char == 'Y' or char == 'Z':
  22.                   char = '9'
  23.  
  24. print(phoneNum)
Parsed in 0.028 seconds