23 votes
Accepted

Create the English word for a number

There's an easier way. We have the num2words module which can be easily installed via pip: ...
Grajdeanu Alex's user avatar
19 votes

Converting numbers to words - Python

This is good work! Well done as a beginner programmer. def changeNumberIntoLetter(value): number=numToLetter(value) return number This function doesn't ...
JaDogg's user avatar
  • 4,531
17 votes

Converting a large number into something like: 4 Novemnongent

I'll put my comments inline. suffixes = ["", "Thousand", "Million", "Billion", "Trillion", "Quadrillion", ... This line is way too long. The standard for Python ...
Snowbody's user avatar
  • 8,442
14 votes
Accepted

Number to English word converter

Switched Let's start with the obvious things we can improve. A return statement terminates the current function. Therefore, all your ...
Zeta's user avatar
  • 19.2k
14 votes

Japanese reading of an integer

Your magnitudes should be chou and kei (as in the supercomputer, as an aside). Also, ...
Ken Y-N's user avatar
  • 247
12 votes
Accepted

Converting number to words

The first step to improve your code: Instead of ...
MarianD's user avatar
  • 1,866
12 votes

Function to spell numbers below 1,000,000,000

...
Ext3h's user avatar
  • 2,789
11 votes

Create the English word for a number

You have quite a big bug there. In this part: ...
ChatterOne's user avatar
  • 2,805
10 votes

Project Euler 17: counting letters needed to write numbers

You don't quite seem to have realized this, but... "One hundred and ..." means that what you can do is, for a 3 digit number - count the hundreds, as "One hundred" and "Two hundred", and then append ...
Pimgd's user avatar
  • 22.3k
10 votes

Integers to English words in C

Keep your line-length under control. Horizontal scrolling is death on readability. strprep() is extremely inefficient, and even assuming the destination is big ...
Deduplicator's user avatar
  • 19.1k
9 votes

Project Euler 17: counting letters needed to write numbers

Simple optimisation At the moment, all your code relies on String : you retrieve Strings, you concatenate them and ultimately, you check the length. An easier solution would be to keep your arrays : ...
SylvainD's user avatar
  • 29.2k
9 votes

Number in words: recursive function

Nice use of """docstrings""". This code is useless: else: "Value out of bounds" If the else clause is reached, the ...
AJNeufeld's user avatar
  • 33.4k
9 votes

Converting int values in Java to human readable strings in English

For the input -2147483648, your program outputs just minus . Also, you never handle 0 ...
200_success's user avatar
8 votes
Accepted

Convert time 24hr format into time as words

Output quality $ scala time.TimeAsWords 00:01 One minute past twelve before midday. $ scala time.TimeAsWords 11:58 Two minutes to twelve before midday. I would ...
200_success's user avatar
8 votes

Japanese reading of an integer

I think it would be better to generate the 漢字 versions of the numbers, as it's more useful in general. Make a separate class responsible for romanization (or phonetic conversion in general so it can ...
briantist's user avatar
  • 1,799
8 votes
Accepted

Japanese reading of an integer

The push function may invoke undefined behavior. When you create a new std::string, I don't think it is guaranteed to be null-...
Roland Illig's user avatar
  • 21.3k
7 votes

Converting a large number into something like: 4 Novemnongent

This approach is based on len(input()). As @Snowbody pointed out, we must be sure that it works even if the user inputs any leading whitespace, sign, base ...
flen's user avatar
  • 233
7 votes
Accepted

Integers to English words in C

Design Your function fails to write a NUL terminator at the end of the output. That means that the caller must zero the entire buffer before calling the function (or else use a ...
200_success's user avatar
7 votes

Japanese reading of an integer

I know in that in English that each word would be separate where the program is printing the all of the numbers merged together. Is this the actual functionality in Japanese? Since the code might be ...
pacmaninbw's user avatar
  • 23.8k
7 votes
Accepted

Converting numbers to text

The "professional" approach would be using libraries that already exist. As agtoever mentioned, there's num2words. So you can do things like: ...
Mast's user avatar
  • 13.3k
6 votes

Number to English word converter

Overall your solution is straightforward and clear. A few areas might be improved including consistency of formatting, enabling and addressing compiler warnings, considering brevity/efficiency/...
user650881's user avatar
6 votes

Converting numbers to words - Python

I did this by inflect pypi library: ...
Benyamin Jafari's user avatar
6 votes
Accepted

Converting int values in Java to human readable strings in English

I'm not keen on the class name or method names - see my alternatives below. I find perhaps a little more logic in the code than I'd look for - normally I try to find some way of making this sort of ...
Mark Bluemel's user avatar
  • 1,532
5 votes
Accepted

Number to word converter (1 to 99 inclusive)

The code is broken. If a number is greater than 20 and ends with 0, print1to20(num_b) will not do what it should. Don't mix the logic with the output. I'd change ...
kraskevich's user avatar
  • 5,580
5 votes
Accepted

Measuring the length of binary numbers in English words in C

Optimization, step by step I ran your program and it took 38.5 seconds to run on my computer. After playing around with it for a bit, I was able to speed it up by 100x. I went through three ...
JS1's user avatar
  • 28.5k
5 votes
Accepted

Converting numbers to words in Haskell

Pattern matching or list element selection? It's possible to reduce the size of ones, tens, ...
Zeta's user avatar
  • 19.2k
5 votes

Number to Text converter in Haskell

I think the primary issue with your current implementation is that it's attempting to do math on strings. For example, ...
ThatsNoMoon's user avatar
5 votes

Converting int values in Java to human readable strings in English

Naming class IntToHumanReadableStringConverter { I would consider "123" to be a human readable string of an int. ...
mdfst13's user avatar
  • 21.5k
4 votes

Function to spell numbers below 1,000,000,000

Your functions for the Low Numbers (<20) should use a dictionary: ...
Graipher's user avatar
  • 40.9k
4 votes

Convert an Integer number to readable format in Java

There is no point in instantiating the class. All the methods could be static (and the constructor private) to provide the same ...
I'll add comments tomorrow's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible