Tips on my code.
Hey everyone, I am stuck on a coach challege and was wondering if I could get some tips or advice on what I have so far. This almost works on all the inputs except one. I don't need the direct answer but would just appreciate any advice you might have because my code is pretty basic. The challenge is to replace any digit under 10 in a sentence with the correct word for the number. phrase = str(input()) numbers = {"0":"zero", "1":"one", "2":"two", "3":"three", "4":"four", "5":"five", "6":"six", "7":"seven", "8":"eight", "9":"nine", "10":"ten"} fixed="" for i in phrase.split(): if i.isdigit()==True: i=int(i) if i >=10: i =str(i) fixed += i +" " else: fixed += numbers[str(i)] + " " else: fixed += i + " " print(fixed)