I need some help with the No Numerals challenge. Failing 1 test case | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
0

I need some help with the No Numerals challenge. Failing 1 test case

I'm not sure what's wrong with the code. The test case it's failing is hidden: https://code.sololearn.com/c82wMVuVBhG9/?ref=app

19th Jan 2020, 6:25 PM
rene tachon
rene tachon - avatar
4 Respostas
0
I give you a hint: Run your code with the input '10'
19th Jan 2020, 6:31 PM
HonFu
HonFu - avatar
+ 1
Create a dictionary mapping numbers 0-10 to its words form. And the. use string replace method to change the value of index matching to that of dictionary
19th Jan 2020, 6:34 PM
–ú–≥. –ö–Ĺ–į–ŅūüƆ
–ú–≥. –ö–Ĺ–į–ŅūüƆ - avatar
+ 1
Thank you. I see the problem now.
19th Jan 2020, 6:44 PM
rene tachon
rene tachon - avatar
+ 1
I've now solved it. Thanks for the replies guys I used a tuple to define the numbers as words. I iterated through it backwards to deal with 10 first. I think the code is quite elegant now.
19th Jan 2020, 7:47 PM
rene tachon
rene tachon - avatar