No numerals | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

No numerals

Can anyone tell me what is the problem with my code. Only two test cases are passed. https://code.sololearn.com/cF07NI3yTHgc/?ref=app

28th Jan 2021, 7:14 PM
Praveen Pandey
2 Answers
+ 5
The problem is that all your different outputs are independent from each other. Just consider a case like 03 where the first digit would be substituted correctly, but afterwards you increment the index and print the raw digit 3 during the same iteration. Instead, you should only execute one output during each iteration, a switch statement or an if-else if-else statement will suit. Also, you need to rethink when to advance the index additionally to the increment at the end of each iteration.
28th Jan 2021, 7:30 PM
Shadow
Shadow - avatar
+ 1
Thanks shadow.
28th Jan 2021, 7:34 PM
Praveen Pandey