Dictionary with python

Total Post:7

Points:49
 209  View(s)
Ratings:
Rate this:

How to implement Dictionary with Python3?

  1. Post:140

    Points:984
    Re: Dictionary with python

    This program uses python like a container it's called dictionary which is in dictionary a key is associated with some information. This program will take a word as input and returns the meaning of that word. 

    Example:

    data = {"mindstick" : "engage in software development and open source for question answer portal."} 

    // Python3 Code for implementing 

    // dictionary

    // importing json library

    import json
    

      // importing get_close_matches fuction from difflib library 

    from difflib import get_close_matches
    

    // loading data

    data = json.load(open("data.txt"))
    

    // defining function meaning

    def meaning(w):
    
    // converting all the letters of "w" to lower case
    w = w.lower()
    

    // checking if "w" is in data 

        if w in data:
    
            return data[w]

     


Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!