0
Please I don't know why this code doesn't execute correctly for all the possibilities
phrase = input() if "0" in phrase and "1" not in phrase: phrase = phrase.replace("0","zero") if "1" in phrase and "0" not in phrase: phrase = phrase.replace("1","one") if "2" in phrase: phrase = phrase.replace("2","two") if "3" in phrase: phrase = phrase.replace("3","three") if "4" in phrase: phrase = phrase.replace("4","four") if "5" in phrase: phrase = phrase.replace("5","five") if "6" in phrase: phrase = phrase.replace("6","six") if "7" in phrase: phrase = phrase.replace("7","seven") if "8" in phrase: phrase = phrase.replace("8","eight") if "9" in phrase: phrase = phrase.replace("9","nine") if "1" in phrase and "0" in phrase: phrase = phrase.replace("10","zero") print(phrase)
2 Answers
+ 2
Input -> 10
Output -> zero â
Expected output -> ten â
0
thank u. I found the error