+ 5

Code Coach No Numerals Python

Hey everybody , can anybody please explain me why the the following code: https://code.sololearn.com/cayQ99UC20R4/?ref=app doens’t work for the No Numerals task: 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. in 2/6 test cases? Thanks! EDIT: finally works with correct spelling. Thanks for the answers.

4th Jan 2020, 1:01 AM
veil5ide
7 odpowiedzi
+ 6
Diego, but shouldn't my version then also fail? inp=input().replace('10', 'ten') for a, b in zip( (str(i) for i in range(10)), 'zero one two three four five six seven eight nine'.split()): inp = inp.replace(a, b) print(inp)
4th Jan 2020, 1:10 AM
HonFu
HonFu - avatar
+ 4
veil5ide Line 19 should be "eight", not "eigth". Also, it's not recommended to use built-in functions (e.g. input) as variable names as it can mess up with your code. HonFu Yes, it should fail. But then again, Code Coach test cases allow for an infinite amount of wrong solutions. I'm still waiting the day someone finally fixes them.
4th Jan 2020, 1:18 AM
Diego
Diego - avatar
+ 3
Hm, funny. It passed anyway. And since it's basically the same version as that of OP, that should pass too, after the spello is corrected, hm? EDIT: And it does. 🙄
4th Jan 2020, 1:20 AM
HonFu
HonFu - avatar
+ 3
🤦‍♂️ Maybe it’s time to bed. Thanks for the anwers.
4th Jan 2020, 1:33 AM
veil5ide
+ 2
Numbers 11 and greater should be left untouched. Input: 42 Output: fourtwo Expected: 42
4th Jan 2020, 1:08 AM
Diego
Diego - avatar
20th Oct 2020, 6:20 AM
イデリセ{非活性}
イデリセ{非活性} - avatar
- 2
Hey what about the challenge 'No-numerals' in code coach? How to verify each letter in a string and replace the number with string? https://www.sololearn.com/coach/64?ref=app
8th Jan 2020, 5:02 AM
Giridhar Talla
Giridhar Talla - avatar