How to seperate digits from a string and convert it into it's word in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to seperate digits from a string and convert it into it's word in python

If input is : i have 2 brother and 1 sister Output should be : i have two brother and one sister

15th Mar 2020, 12:51 AM
Abdul Rahiman Masood
Abdul Rahiman Masood - avatar
4 Answers
+ 7
Use dictionaries in python
15th Mar 2020, 1:39 AM
Ben
Ben - avatar
+ 6
Mihai Apostol [ ⚓ INACTIVE] There is a cool hack to install modules not normally available on SL. Saw it done by Coding Einstein first and it was refinef by @pluto. See here https://code.sololearn.com/ctq6QdY174r8/?ref=app
15th Mar 2020, 4:35 AM
Louis
Louis - avatar
+ 4
Take a look at the module: inflect https://pypi.org/project/inflect/ Note. It is not working on SL!
15th Mar 2020, 1:02 AM
Mihai Apostol
Mihai Apostol - avatar
+ 2
I prefer using a dictionary
20th Mar 2020, 12:05 AM
Edstech dua
Edstech dua - avatar