Tuesday, July 23, 2013

Dictionary With Python

Python is a fast programming language as compared to other programming languages such as C, C++, java.. Also it is have a dictionary class which is very useful to create databases. So I thought writing a dictionary app with python would be efficient, fast and easy to build up.

If you don't have python installed in your system, you can see the installation instructions from my an older post installing python. The required steps I have determined are in the following.

Required Steps:
  1. Create the database.
  2. Take an input from the user.
  3. Search the word user entered in the database.
  4. If database has it, write down the corresponding meaning of the word.

This four steps will be enough to make a simple dictionary, but I want to add a new feature which is 'Adding New Word' feature. I mean the user can be able to add new words if the database has not it. By doing this the user will be able to grow up database of the dictionary. In other words, the user will generate his/her own dictionary. So additional steps are give in the following.

Additional Steps:
    1. If database hasn't it, ask to user 'is he/she want to add the new word'.
    2. If yes, take the new word and its meaning from user.
    3. Add it to the database.
    4. Close the Dictionary.
By using to-do list above, I wrote the following script in python. I named it as Mpdictionary. The code is given below:

The Code:
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------

Working windows:


If you have any question or need some help, leave a comment below.


No comments:

Post a Comment