Select Page

This is the python3 program, I wrote to convert a number into words. If you enter 464, it will print Four Six Four.

The Flowchart

This is the Flow Chart that I used to visualize my ideas.

The Code

a=input("Enter a random number:")
a=int(a)
names=["zero", "one", "two", "three",
"four", "five", "six", "seven",
"eight", "nine"]
b=a
in_words=""
while(b>0):
d=b%10
b=b//10
in_words=names[d]+" "+in_words
print(a, "In words is,",in_words)

The Output