Where is my error ? Problem no numerals | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Where is my error ? Problem no numerals

a=input() for i in a: if(i=="0"): print("zero",end="") elif (i=="1"): print ("one",end="") elif (i=="2"): print ("two",end="") elif (i=="3"): print ("three",end="") elif (i=="4"): print ("four",end="") elif (i=="5"): print ("five",end="") elif (i=="6"): print ("six",end="") elif (i=="7"): print ("seven",end="") elif (i=="8"): print ("eight",end="") elif (i=="9"): print ("nine",end="") elif (i=="10"): print ("ten",end="") else: print (i,end="")

12th Jan 2023, 12:45 PM
Dadaxon Xudayberganov 👑 🇺🇿🇺🇿
Dadaxon Xudayberganov 👑 🇺🇿🇺🇿 - avatar
3 Answers
+ 8
Dadaxon Xudayberganov 🇺🇿🇺🇿🇺🇿 , > to replace the digits by a *word-number*, we have to split the input sentence to a list of individual words. > after this we can iterate over this list and start the replacement and the output.
12th Jan 2023, 3:50 PM
Lothar
Lothar - avatar
+ 2
Loop iterates by each single character so it never reads "10" by loop.. and will be read as "1"," 0".
12th Jan 2023, 12:49 PM
Jayakrishna 🇮🇳
0
O, I forget it, thanks
12th Jan 2023, 1:01 PM
Dadaxon Xudayberganov 👑 🇺🇿🇺🇿
Dadaxon Xudayberganov 👑 🇺🇿🇺🇿 - avatar