Ad
Code
Diff
  • def converter(number):
        try:
            return ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"][number]
        except IndexError:
            return None
    
    • def converter(number):
    • if 0<=number<10:
    • return ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"][int(number)]
    • else:
    • try:
    • return ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"][number]
    • except IndexError:
    • return None