+ 1
Please somebody help me i m stuck in the Test Case 3.I don't know why my code is not working!!!
It's a problem in the community section named "No Numerals". Here's my code:- https://code.sololearn.com/cG8dgn7GFbbl/?ref=app
5 Answers
+ 6
Vaibhav Pandey ,
the code as it is, is iterating over the input string character by character. this causes issues.
> what you can do is to split the input string by space. this creates a list of strings / words / tokens.
> then iterate over the splitted input. we do not need to use a nested while / for loop. just use a for loop.
> after having identified strings that are in the *num* dictionary, replace the numbers by the related strings.
> try avoid str.replace(), since this will replace all matches. when having '100' in the input, the result will be 'onezerozero',
even if this should not be modified. try to modify the relevant items by using an index.
+ 6
Vaibhav Pandey ,
for passing the test cases we need to print out a *string*.
> the current output your code is doing is a *list*.
+ 2
Lothar okay bro I will try next morning.
+ 1
Lothar Thank you bro I did it with using only for loop.
https://code.sololearn.com/c0TMmMTLF7af/?ref=app
+ 1
Lothar oh i forgot I just added " ".join(msg) to the print statement