+ 7
it fail in 3 test case
d1={"0":"zero","1":"one","2":"two","3":"three","4":"four","5":"five","6":"six","7":"seven","8":"eight","9":"nine","10":"ten"} n=input() for i in n: if i in d1: n=n.replace(i,d1[i]) print(n)
9 Respostas
+ 6
That's why I said you have to do 10 *before* the loop.
dict will check for 1 first.
'110' -> 'oneone0'
No 10 left.
+ 8
Hi Nihal gupta
Make sure to link code coach challenge link too while asking question.
You need to read the code coach problem properly to correct your code(you need to account for 10 too)
I hope it helps.
+ 4
Nihal gupta , I think you should include in your dictionary also "10" 🐱
+ 3
where is the problem in this code?
+ 3
i already try with including 10 in my dict but it also not work
+ 3
ok thank you
+ 2
You first have to replace '10', and then the loop.
+ 1
I think its better to use a list and replace all numbers because in your code 10 is considered as two character. So you need to loop the string as "word" wise.