I am trying to convert a random telephone number from a number into words using dictionaries using the following code:
dict_1 = {07: \'zero seven\'} dict_2 = {2
Why not just:
def phone(number): numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] return ' '.join(numbers[c] for c in map(int, number))
Result:
>>> phone('0734123456') 'zero seven three four one two three four five six'