+ 2

No numerals problem

Why i cant pass test case 3 my code seems correct?? h=input().split() dic={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"} no_nemerals=[dic[int(word)] if word.isdigit() and int(word)<10 else word for word in h] print(" ".join(no_nemerals))

10th May 2025, 11:37 AM
Nasrollah khantoul
Nasrollah khantoul - avatar
1 Réponse
+ 6
Your code doesn't handle the case when one inputs "10", e.g. "1 queen and 10 honey bees". Note that in the instructions it says that a number can also be 10. Tag the relevant programming language instead of "?"
10th May 2025, 11:49 AM
Lisa
Lisa - avatar