Please, help! Where is mistake in my code? No numerals | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please, help! Where is mistake in my code? No numerals

The task is: Take a phrase and replace any instances of an integer from 0-10 and replace it with the English word that corresponds to that integer. Input Format: A string of the phrase in its original form (lowercase). Output Format: A string of the updated phrase that has changed the numerals to words. https://code.sololearn.com/cmBkg01Q6URC/?ref=app

2nd Jan 2021, 12:22 PM
Ela O
Ela O - avatar
4 Answers
+ 5
From line 7 remove .toLowerCase().toUpperCase().toLowerCase() It's unnecessary since the The given input format is already in lowercase. But P∆WAN M∆URY∆ can you explain why the test cases didn't pass when he used .toLowerCase().toUpperCase().toLowerCase() on line 7? Ultimately the string is in lowercase, then how does it makes difference in output?
2nd Jan 2021, 12:42 PM
Minho
Minho - avatar
+ 4
You're welcome 😊
2nd Jan 2021, 12:46 PM
Minho
Minho - avatar
+ 3
Hi Minho 🇰🇷, I don't think so sololearn test cases are dealing with lowercase phrases. They are dealing with original string phrases and that's why some of the cases are not pass because they are trying to match with original content after replacing numerals. So input format should be orginal that's it and they just try to manipulate us.
3rd Jan 2021, 4:24 AM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 1
Thanks a lot! It works now!
2nd Jan 2021, 12:45 PM
Ela O
Ela O - avatar