Help whats problem of my code . In No numerals | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help whats problem of my code . In No numerals

Problem in test case 3,4,5 txt = str(input()).lower() def No(text): Numerals = { "1": "one","2": "two","3":"three","4": "four", "5": "five","6": "six","7": "seven","8":"eight","9": "nine","10": "ten", "0": "zero" } temp = [] txt = list(text) for i in txt: num = i.isnumeric() if num == True: temp.append(Numerals[i]) else: temp.append(i) print("".join(temp)) No(txt);

3rd Nov 2020, 8:26 AM
Restituto A. Ochea
Restituto A. Ochea - avatar
2 Answers
+ 1
10 is read as 1 and 0 instead of 10 so you get "one zero" as output if there is 10 in inputted string Change , for i in txt to => for i in txt.split()
3rd Nov 2020, 8:29 AM
Abhay
Abhay - avatar
0
Same result i change the value under 10 and change the expression of for loop but the error is the same. Failed in case 3,4,5
3rd Nov 2020, 9:30 AM
Restituto A. Ochea
Restituto A. Ochea - avatar