+ 1

Can any one tell me that how can I pass test case#3 in No numerals challenge and what's wrong in the code below

Using Python https://code.sololearn.com/cmkK7WhEvCeW/?ref=app

19th Aug 2020, 2:27 PM
Purbayan Saha
Purbayan Saha - avatar
3 Respostas
+ 1
10 should be early then 1 and 0
19th Aug 2020, 2:35 PM
[][]
20th Oct 2020, 6:25 AM
イデリセ{非活性}
イデリセ{非活性} - avatar
0
First of all 10 is replaced by onezero and secondly numbers greater than 10 should not be replaced, should they? Moreover all this replaces look ugly! Try this instead: inp = input() num = ["10","0","1","2","3","4","5","6","7","8","9","10"] alp = ["zero","one","two","three","four","five","six","seven","eight","nine","ten"] for n in num: if n in inp: inp = inp.replace(n,alp[int(n)]) print(inp)
19th Aug 2020, 2:45 PM
Alexander Thiem
Alexander Thiem - avatar