Dictionary :)
def converter(number): dictionary = { 0: "zero", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine", 10: 10 } return dictionary[number]
- 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- dictionary = {
- 0: "zero",
- 1: "one",
- 2: "two",
- 3: "three",
- 4: "four",
- 5: "five",
- 6: "six",
- 7: "seven",
- 8: "eight",
- 9: "nine",
- 10: 10
- }
- return dictionary[number]