You write a phrase and include a lot of number characters (0-9), but you decide that for numbers 10 and under you would rather w | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

You write a phrase and include a lot of number characters (0-9), but you decide that for numbers 10 and under you would rather w

s=input() n={0:"zero",1:"one",2:"two",3:"three",4:"for",5:"five",6:"six",7:"seven",8:"eighth",9:"nine"} i=0 s=s.replace("10","ten") while (i<10): s=s.replace(str(i),n[i]) i=i+1 print(s) I don't understand what i write wrong 🤷

25th Nov 2021, 12:30 PM
Կարեն Բայադյան
Կարեն Բայադյան - avatar
3 Answers
+ 6
4 -> four 8 -> eight
25th Nov 2021, 1:19 PM
Simba
Simba - avatar
+ 4
Կարեն Բայադյան , if you are talking about code coach exercice "no numerals": the code may work for you, but it does not pass the test cases. there are several issues that does not create error messages, but they give incorrect results. giving input like: 'hello 1 5 123', the result will be: 'hello one five onetwothree'. but it should not touch the last number 123.
25th Nov 2021, 3:36 PM
Lothar
Lothar - avatar
+ 2
Simba it's work Kimba oh Simba 😉😁 👏
25th Nov 2021, 1:26 PM
Կարեն Բայադյան
Կարեն Բայադյան - avatar