Ad
Code
Diff
  • DATA = {0:'zero',1:'one',2: 'two',3: 'three',4: 'four',
               5: 'five',6:'six',7:'seven',8:'eight',9:'nine'}
    def converter(number):
        return DATA.get(number,number)
    
    • DATA = {0:'zero',1:'one',2: 'two',3: 'three',4: 'four',
    • 5: 'five',6:'six',7:'seven',8:'eight',9:'nine'}
    • def converter(number):
    • match number:
    • case 0:
    • return 'zero'
    • case 1:
    • return 'one'
    • case 2:
    • return 'two'
    • case 3:
    • return 'three'
    • case 4:
    • return 'four'
    • case 5:
    • return 'five'
    • case 6:
    • return 'six'
    • case 7:
    • return 'seven'
    • case 8:
    • return 'eight'
    • case 9:
    • return 'nine'
    • case _:
    • return number
    • return DATA.get(number,number)