Kevin Tiller

Generation

generate functionSat, 22 Apr 2023

Write a function that converts an int num between 0-9 (inclusive) to its string equivalent (i.e., 1 -> "one").

def int_to_word(num): if num == 0: return "zero" if num == 1: return "one" if num == 2: return "two" if num == 3: return "three" if num == 4: return "four" if num == 5: return "five" if num == 6: return "six" if num == 7: return "seven" if num == 8: return "eight" if num == 9: return "nine" int_to_word(9)

Want to kickstart your project?Use the new AI Studio to create your code