+ 4

Some one help third case is failed in no numerials

string=input() dct={'0':'zero','1':'one','2':'two','3':'three','4':'four', '5':'five','6':'six','7':'seven','8':'eight','9':'nine' ,'10':'ten'} newstr='' for ch in string: if ch.isdigit()==True: dw=dct[ch] newstr=newstr+dw else: newstr=newstr+ch print (newstr)

4th May 2020, 3:20 PM
ĂŠshrĂźth.htm
ĂŠshrĂźth.htm - avatar
4 Answers
+ 3
Your code is not converting 10 to "ten".
4th May 2020, 3:24 PM
Arsenic
Arsenic - avatar
4th May 2020, 3:27 PM
Arsenic
Arsenic - avatar
+ 3
As soon as your code encounters "1" it equates it to "one" and then compare next with "0" leading to the output as "onezero" instead of "ten"
4th May 2020, 3:30 PM
Arsenic
Arsenic - avatar
+ 2
I have mentioned
4th May 2020, 3:26 PM
ĂŠshrĂźth.htm
ĂŠshrĂźth.htm - avatar