+ 1

I Need help [SOLVED]

I’m trying to make a “numbers to words” code but without def function. Also I can’t use ready modules. I define numbers as: number = input(“please enter any number: “) while not (number.isdigit()): print(“Only integers allowed”) print(“Type any integer here: “) number = input() single_numbers = [“”, “one”, “two”, “three”, ...] decimal = [“ten”, “twenty”, “fourty”, ...] hundred = [“hundred”,] thousand = [“thousand”,] million = [“million”,] word = “” length = len(number) len_num = length up_change = 0 while len_num > 0: if number == “0”: word = “zero” break else: for i in .......... . . . How to continue this one? Actually I’m asking for my native language. Because my language’s number system is different. For example: 11 = eleven but it’s like ten+one and 1000 = one thousand in English but one + thousand in my language. I want to see the logic and apply to mine. Beside list also dictionary is ok too. Thanks in advance.

9th Sep 2020, 4:16 PM
YAKUP KARAKAƞ
YAKUP KARAKAƞ - avatar
2 RĂ©ponses
+ 1
You language translation is easy than English.. First just find length of input number then number//10**length-1 will give last number that you already no 'length' place For ex: 1000 1000//10**3 will return 1, thousand.. Repeat by this by length-=1,num//10**3 next 2,1,0
9th Sep 2020, 8:41 PM
Jayakrishna 🇼🇳
0
Jayakrishna🇼🇳 thanks let me try this one.
10th Sep 2020, 5:22 AM
YAKUP KARAKAƞ
YAKUP KARAKAƞ - avatar