Telephone digits to letters

Question

Suppose you're given a portion of a phone number. Each digit corresponds to letters (as shown below). Using python, write code to return all possible combinations the given number could represent.

Telephone digits, for reference:

Telephone digits to letters - 1

For example:

Input: "24"
Output: 
['a', 'g']
['a', 'h']
['a', 'i']
['b', 'g']
['b', 'h']
['b', 'i']
['c', 'g']
['c', 'h']
['c', 'i']

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now