Challenge

Project 1 - English Dictionary App & Library Book Management System

#1A: English Dictionary App

import json

print('Welcome to the Dictionary App')
print('Please select your choice')
print('1. Add a word')
print('2. Find the meaning')
print('3. Update the word')
print('4. Exit')


f = open('words.txt','w')
coll_words = {}
json.dump(coll_words,f)
f.close()

while True:
n = int(input('Enter the Choice:'))
if n == 1:
import json
f = open('words.txt','w')
word = input('Enter a word : ')
meaning = input('Enter its meaning : ')
coll_words[word] = meaning
json.dump(coll_words,f)
f.close()

elif n == 2:
import json
f = open('words.txt','r+')
dic = json.load(f)
find = input('Enter the word to find: ')
if find in coll_words:
print('The meaning is',coll_words.get(find))
else:
print('Sorry the word is not found')
json.dump(coll_words,f)
f.close()
elif n == 3:
import json
f = open('words.txt','w')
word1 = input('Enter the word:')
update_meaning = input('Enter the updated meaning: ')
coll_words[word1] = update_meaning
json.dump(coll_words,f)
f.close()
elif n == 4:
print('Thank you for choosing Dictionary app')
break
else:
print('Please enter the mentioned choice')
print('1. Add a word')
print('2. Find the meaning')
print('3. Update the word')
print('4. Exit')

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.