Challenge

Project 1 English Dictionary App

import json

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

data1 = open('words.txt','w')
mean = {"pendent": "hanging, overhanging",
"Combat": "Cobattle, oppose"
,"serenity": "a state of being calm, peaceful"
,"strike": "hit, deliver blows, dash"
,"pent": "shut up",
"Dale": "valley",
"Bulk": "magnitude, size,",
"Cess": "rate of tax"}
json.dump(mean,data1)
data1.close()

while True :
x = int(input('Select the option from Main menu : '))

if x==1 :

data1= open('words.txt','a')
w1 = input('Enter the new word : ')
m1 = input('Enter meaning of given word : ')
mean[w1]=m1
json.dump(mean,data1)
data1.close()

elif x==2 :

data2 = open('words.txt','r')
word1 = json.load(data2)
w1 = input("Enter word: ")
if w1 in word1:
print(w1,'means :',word1[w1])
else:
print("The word doesn't exist.")

elif x==3:

data3= open('words.txt','w')
u_w1 = input('Enter the new word : ')
m2 = input('Enter meaning of given word : ')
mean[u_w1]=m2
json.dump(mean,data3)
data3.close()

elif x==4 :

print('Thanks')
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.