I need some help with the No Numerals challenge. Failing 1 test case | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 Answers
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