+ 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.
7 Respostas
+ 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)
+ 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.
+ 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. đ
+ 3
đ€Šââïž Maybe itâs time to bed.
Thanks for the anwers.
+ 2
Numbers 11 and greater should be left untouched.
Input: 42
Output: fourtwo
Expected: 42
- 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