Menu
Questions
Search

x

This site uses cookies to store data and improve customer experience. You can find out more about this in our privacy section




Python programming

Blessed

03:13:26pm

2020/03/07

Writing a Python program that converts numbers written in words to figures. - It should be able to convert numbers less than one million to digits form. - It should be able to detect strange or wrongly spelled words and display appropriate error message
 


Click to Answer 5 Answers


Rated Best Answer


icogrowser

11:38:04pm

2020/03/08

You can set-up the dictionary like this below and make a function to compare the items in it.
#We would be using Dictionaries
words_convert = {'zero': 0, 'one': 1, 'two': 2, 'three':3, 'four':4,  'five':5, 'six':6,  'seven':7, 'eight': 8, 'nine':9, 'ten':10, \
            'eleven':11, 'twelve':12, 'thirteen':13, 'fourteen':14, 'fifteen':15,  'sixteen':16, 'seventeen':17, 'eighteen':18,\
            'nineteen':19, 'twenty': 20, 'thirty' : 30, 'forty': 40, 'fifty': 50, 'sixty': 60, 'seventy': 70, 'eighty': 80, 'ninety': 90, 'hundred': 100, \
                 'thousand': 1000, 'million': 1000000} 


rate 0 comment

Comments





More Answers





icogrowser

11:00:47pm

2020/03/08

You should use python dictionaries
 


rate 0 comment

Comments




More Answers





icogrowser

11:24:16pm

2020/03/08

I added a full image of the code and the output
 

Screenshot (108).png
rate 0 comment

Comments




More Answers





icogrowser

12:01:18am

2020/03/09

For the full text-file. People can get to download or open the code from here
 


rate 0 comment

Comments




More Answers





Ubeedominic

11:41:20am

2020/03/09

This is my contribution
 


rate 0 comment

Comments






A1 IN ONE

join the world around you

Do you know you can ask any question in A1in1

Join the community of millions of people around the world ready to share knowlegde and improve themselves.

From Religious matters to political matters to computer programming to hacking and even life style we got you covered

Meet the world around you

"The world is really becoming a very small place with technologies like A1in1."

You can decide to sign up today to join our world of different research. It is absolutely free.

We are building one of the worlds greatest cypto's

The best you can do now is to invest in the grows coins.

The struture of this coin is going to be quite different from what the world has seen and it would be released soon. However you can donate to the developpers or invest before it's release.

Your question is another man's answer

Do you know that any question playing in your mind right now has already been answered by Men or may be Aliens-A1.

.

Quote of the day: Give thanks and build the impossible.






x
x






x

Please Complete your user details.











x

Set User Security Details










x

Register
x the process was successful

Successful.

Use the link sent to your email to verify your account

x the process was successful

Warning

This is the problem we have