Solved: No numerals | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Solved: No numerals

import re txt= input() numes ={"0":"zero","1":"one","2":"two","3":"three","4":"four","5":"five","6":"six","7":"seven","8":"eight","9":"nine","10":"ten"} for gi in txt.split(): if gi in numes: txt =re.sub(gi,numes[gi],txt) print(txt)

12th Sep 2022, 12:10 PM
Israel Mutebi
4 Answers
+ 4
Solved...! Then why this in q/a? You can share in feed post or in special thread for code advertisement. So use those.. But posting here is spamming. edit: https://www.sololearn.com/discuss/1316935/?ref=app https://www.sololearn.com/discuss/333866/?ref=app
12th Sep 2022, 12:20 PM
Jayakrishna 🇮🇳
+ 3
Israel Mutebi , maybe there can be done an improvment: this input: hello 1 2 3 4 5 6 7 8 9 10 11 12 100 results in: hello one two three four five six seven eight nine one0 oneone onetwo one00
12th Sep 2022, 1:19 PM
Lothar
Lothar - avatar
+ 2
Israel Mutebi , maybe you can have a look at this codes gives you an idea how to do the task with re.sub() https://code.sololearn.com/cuenyCP0qTCr/?ref=app
13th Sep 2022, 9:38 AM
Lothar
Lothar - avatar
0
Thx Lothar Let me try this out also
12th Sep 2022, 4:29 PM
Israel Mutebi