Challenge

Project 1 English Dictionary App

import json

print('''
         Welcome To Ashay's Dictionary
         ''')

print('                   1 Add a new word')
print('                   2 Find the meaning')
print('                   3 Update a word')
print('                   4 Exit')

print('$'*70)

data_w = open('words.txt','w')
grp = {'#':'Hash','simple': 'easy'}
json.dump(grp,data_w)
data_w.close()


while True :
    choice= int(input('Enter a Choice No :'))
    if choice == 1:
        
        data_w = open('words.txt','w')
        add_word = input('Enter a Word :')
        meaning = input('Enter Meaning :')
        grp[add_word] = meaning
        json.dump(grp,data_w)
        data_w.close()
        
        
    elif choice == 2:
       
        data_r = open('words.txt','r')
        word_dikt = json.load(data_r)
        xi = input('Enter a Word :')
        if xi in word_dikt:
             print('The meaning of ',xi,' is ',word_dikt[xi])
        else:
            print('Word not found')
                
    elif  choice == 3:
        
        data_w = open('words.txt','w')
        update_word = input('Enter a Word :')
        meaning = input('Enter Meaning :')
        grp[update_word] = meaning
        json.dump(grp,data_w)
        data_w.close()
        
    elif choice == 4:
        print('Thanks for using my Dictionary')
        break
        
 
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.