+ 5

Code couch

There is changing about No number found in code couch the code running seccsed by 90% whats is missing Challenge Link:https://www.sololearn.com/coach/64?ref=app My code:- word=input() word=word.replace("0","zero") word=word.replace("1","one") word=word.replace("2","two") word=word.replace("3","three") word=word.replace("4","four") word=word.replace("5","five") word=word.replace("6","six") word=word.replace("7","seven") word=word.replace("8","eight") word=word.replace("9","nine") print(word) JaScript Rain Keith

7th Jan 2024, 1:11 PM
Mohammed Hassan
Mohammed Hassan - avatar
13 Respostas
+ 4
As Rain above mentioned.
7th Jan 2024, 1:33 PM
JaScript
JaScript - avatar
+ 3
Rain i was added this statment but still not fully success Word=wors.replace("10","ten")
7th Jan 2024, 2:36 PM
Mohammed Hassan
Mohammed Hassan - avatar
+ 3
Mohammed Hassan word not wors. and where you add it matters a lot.
7th Jan 2024, 2:48 PM
Bob_Li
Bob_Li - avatar
+ 3
JaScript Rain Bob_Li I made misstake the ten i added into the last . I move this statement into the up and code complete seccssfully Thanks for All of you
7th Jan 2024, 2:53 PM
Mohammed Hassan
Mohammed Hassan - avatar
+ 3
I used a dictionary to map key:value pairs to solve this Code Coach. Hope that helps 👍
7th Jan 2024, 9:47 PM
Keith
Keith - avatar
+ 3
speaking of number to words, here is a convenient module: num2words https://sololearn.com/compiler-playground/c9FkN41Q8fba/?ref=app unfortunately, the code coach test times out if you attempt to install the module.
7th Jan 2024, 10:25 PM
Bob_Li
Bob_Li - avatar
+ 2
Mohammed Hassan , Thanks for including the link to the Code Coach. It makes it much easier to read the description. The description says replace 0 to 10. You replaced 0 to 9. 10 is trickier, because 10 has two digits, and you don't want to replace it with "onezero". There's an easy way though. Good luck.
7th Jan 2024, 1:15 PM
Rain
Rain - avatar
+ 2
first do ten
7th Jan 2024, 2:28 PM
Bob_Li
Bob_Li - avatar
+ 2
Mohammed Hassan , Yeah, that's the trick. "Hang ten" at the front of your surfboard. Heh. 👍
7th Jan 2024, 5:17 PM
Rain
Rain - avatar
+ 1
Bob_Li yes
7th Jan 2024, 2:52 PM
Mohammed Hassan
Mohammed Hassan - avatar
+ 1
Rain Yea but why should habg at front
7th Jan 2024, 5:32 PM
Mohammed Hassan
Mohammed Hassan - avatar
+ 1
Mohammed Hassan , Oh. I thought you figured it out already, since you said it passed. You hang 10 at the front (replace 10 first) so you can later replace 0 and replace 1 without turning 10 into "onezero".
7th Jan 2024, 6:38 PM
Rain
Rain - avatar