Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. def num_to_char(value):
  2. if value == 2: return ["a","b","c"]
  3. if value == 3: return ["d","e","f"]
  4. if value == 4: return ["g","h","i"]
  5. if value == 5: return ["j","k","l"]
  6. if value == 6: return ["m","n","o"]
  7. if value == 7: return ["p","q","r","s"]
  8. if value == 8: return ["t","u","v"]
  9. if value == 9: return ["w","x","y","z"]
  10.  
  11. def convert_num(number, current_string = ""):
  12. if number == []:
  13. print(current_string)
  14. return
  15. get_list = num_to_char(int(number[0]))
  16. for character in get_list:
  17. current_string += character
  18. if len(number) >= 1:
  19. convert_num(number[1:], current_string)
  20. current_string = current_string[:-1]
  21.  
  22. num_to_covert = list("23")
  23. convert_num(num_to_covert)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement