+ 4
Why this code doesn't perform correctly in code coach? Please help.
change_char = {'1':'one', '2':'two', '3':'three', '4':'four','5':'five', '6':'six','7':'seven', '8':'eight','9':'nine','0':'zero','10':'ten'} nums = ['1','2','3','4','5','6','7','8','9','0'] y = str(input()) for i in y: if i in nums: y = y.replace(i, change_char[i]) print(y)
5 Answers
+ 7
Avinash So you want solution :P ?
+ 8
I think there is one test case with number 10 which your program doesn't take. It will take 1 and 0 separately and replace with one and zero but it wants ten. Hence the problem..
+ 5
I already thought about that...
+ 4
Hmm..
+ 4
I've also stuck in another code coach...