I need write a program that will print to the screen all of the words (and the associated numbers) that could be generated through an 800 phone number that has the prefix 555. Remember that the numbers 1 and 0 on a keypad do not have letters associated with them.
What I have tried to so far is as follows:
alph_num_dict = {'a': '2', 'b': '2', 'c': '2',
'd': '3', 'e': '3', 'f': '3',
'g': '4', 'h': '4', 'i': '4',
'j': '5', 'k': '5', 'l': '5',
'm': '6', 'n': '6', 'o': '6',
'p': '7', 'q': '7', 'r': '7', 's': '7',
't': '8', 'u': '8', 'v': '8',
'w': '9', 'x': '9', 'y': '9', 'z': '9'}
for letter, digit in alph_num_dict.items():
print ("1.800.555." + str(digit) + str(digit) + str(digit) + str(digit), end=" ")
print (" 1.800.555." + str(letter) + str(letter) + str(letter) + str(letter))
The output that I get is:
1.800.555.2222 1.800.555.aaaa
1.800.555.2222 1.800.555.bbbb
1.800.555.2222 1.800.555.cccc
1.800.555.3333 1.800.555.dddd
1.800.555.3333 1.800.555.eeee
1.800.555.3333 1.800.555.ffff
1.800.555.4444 1.800.555.gggg
1.800.555.4444 1.800.555.hhhh
1.800.555.4444 1.800.555.iiii
1.800.555.5555 1.800.555.jjjj
1.800.555.5555 1.800.555.kkkk
1.800.555.5555 1.800.555.llll
1.800.555.6666 1.800.555.mmmm
1.800.555.6666 1.800.555.nnnn
1.800.555.6666 1.800.555.oooo
1.800.555.7777 1.800.555.pppp
1.800.555.7777 1.800.555.qqqq
1.800.555.7777 1.800.555.rrrr
1.800.555.7777 1.800.555.ssss
1.800.555.8888 1.800.555.tttt
1.800.555.8888 1.800.555.uuuu
1.800.555.8888 1.800.555.vvvv
1.800.555.9999 1.800.555.wwww
1.800.555.9999 1.800.555.xxxx
1.800.555.9999 1.800.555.yyyy
1.800.555.9999 1.800.555.zzzz
This is only part of the output that I need. I need to be able to output all of the other possible combinations (there are 456,976 of them.) I am having trouble figuring out how to get the output for all of the possible combinations.
To clear things up, I need the output to start off looking something like:
1.800.555.2222 1.800.555.aaaa
1.800.555.2222 1.800.555.aaab
1.800.555.2222 1.800.555.aaac
1.800.555.2223 1.800.555.aaad
1.800.555.2223 1.800.555.aaae
1.800.555.2223 1.800.555.aaaf
Any help with this would be greatly appreciated.