PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# read phrase and split into word list
phrase = input().split()
# list used for converting numbers
convert = ("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten")
# loop over words in phrase
for i in range(0, len(phrase)):
# check if word only contains numbers
if phrase[i].isnumeric():
# convert word to integer
num = int(phrase[i])
# check if number 10 or less
if num <= 10:
# overwrite with new string number
phrase[i] = convert[num]
# rejoin phrase words and print
print(" ".join(phrase))
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run