+ 2

How can I print ten with this code

This code just prints one0 but how can I do it to print ten not one0 This is the code: def no_numerals(phrase): translation = "" number_letters = { "1": "one", "2": "two", "3": "three", "4": "four", "5": "five", "6": "six", "7": "seven", "8": "eight", "9": "nine", "10": "ten", } for letter in phrase: if letter in number_letters: translation = translation + number_letters[letter] else: translation = translation + letter else: print(translation) no_numerals(str(input()))

27th Dec 2019, 4:33 PM
Progress Osemudiamen Emuan
Progress Osemudiamen Emuan - avatar
7 Respostas
+ 2
Thank a lot
28th Dec 2019, 5:08 PM
Progress Osemudiamen Emuan
Progress Osemudiamen Emuan - avatar
+ 1
Nirmalya Bakshi It works thanks just that I can'mix it with other letters
27th Dec 2019, 5:13 PM
Progress Osemudiamen Emuan
Progress Osemudiamen Emuan - avatar
+ 1
Nirmalya Bakshi Doesn't work
27th Dec 2019, 5:39 PM
Progress Osemudiamen Emuan
Progress Osemudiamen Emuan - avatar
+ 1
Nirmalya Bakshi how would it work in the same line
28th Dec 2019, 10:12 AM
Progress Osemudiamen Emuan
Progress Osemudiamen Emuan - avatar
+ 1
Nirmalya Bakshi there is not one space between them
28th Dec 2019, 4:57 PM
Progress Osemudiamen Emuan
Progress Osemudiamen Emuan - avatar
+ 1
Yes
28th Dec 2019, 5:03 PM
Progress Osemudiamen Emuan
Progress Osemudiamen Emuan - avatar
+ 1
Nirmalya Bakshi there is a problem you can't do as the function you can print numbers alone but you can't do it mixed with other strings or different texts apart from the ones in the dictionary See I want this that will make me to be able to do this ##hello 10 outputs with the function ##Hello ten ##hi bro 3 ##hi bro three thanks
28th Dec 2019, 8:50 PM
Progress Osemudiamen Emuan
Progress Osemudiamen Emuan - avatar