+ 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)
4 Réponses
+ 3
Your code is not converting 10 to "ten".
+ 3
Are you sure👇
https://code.sololearn.com/cz9QqgLM21I5/?ref=app
+ 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"
+ 2
I have mentioned