Created
November 17, 2018 13:14
-
-
Save Dhrumilcse/d7d78b485ab0f972dac64e0cde8c9f48 to your computer and use it in GitHub Desktop.
Dictionary Part 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Import library | |
import json | |
#Loading the json data as python dictionary | |
#Try typing "type(data)" in terminal after executing first two line of this snippet | |
data = json.load(open("data.json")) | |
#Function for retriving definition | |
def retrive_definition(word): | |
return data[word] | |
#Input from user | |
word_user = input("Enter a word: ") | |
#Retrive the definition using function and print the result | |
print(retrive_definition(word_user)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment