if the input is 123 the output will be onetwothree

Recommended Answers

All 2 Replies

Like base conversion with modulo, backwards, adding numbers in front of string instead of end.

Pseudocode:

def wordy(n):
    w = ''
    if n == 0:
        return 'zero'
    else:
        while n > 0:
            w = number[n%10] + w
            n /= 10
        return w


number = "zero one two three four five six seven eight nine".split()
print wordy(12345635252524524)
#Output:
#onetwothreefourfivesixthreefivetwofivetwofivetwofourfivetwofour
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.