+ 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

17th Jul 2023, 5:02 PM
Vaibhav Pandey
5 odpowiedzi
+ 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.
17th Jul 2023, 5:41 PM
Lothar
Lothar - avatar
+ 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*.
18th Jul 2023, 10:32 AM
Lothar
Lothar - avatar
+ 2
Lothar okay bro I will try next morning.
17th Jul 2023, 6:06 PM
Vaibhav Pandey
+ 1
Lothar Thank you bro I did it with using only for loop. https://code.sololearn.com/c0TMmMTLF7af/?ref=app
18th Jul 2023, 5:55 AM
Vaibhav Pandey
+ 1
Lothar oh i forgot I just added " ".join(msg) to the print statement
18th Jul 2023, 10:37 AM
Vaibhav Pandey