Challenge

Project 1 - English Dictionary App & Library Book Management System

1)

Code has implemented with Dictionary data structure to insert key and value that means word and meaning after that by using serialization and deserialization(load and dump funtions) to store data in JSON format,

##1
##1A: English Dictionary App

import json

r_word=open('words.txt','r')

data = json.loads(r_word.read())


while True:

select= input('select item1 or item2 or choice3 or choice4:')
print('Here is your data:',data)

if select == 'item1':

enter = input('Enter the word:')

meaning = input('enter the meaning:')

data[enter]= meaning


elif select == 'item2':

enter = input('Enter the word:')
if enter in data:

print("meaning - ",data[enter])

else:
print('Sorry word doesnt found')

elif select == 'choice3':

enter = input('Enter the word:')

meaning = input('enter the meaning:')

data[enter] = meaning



elif select == 'choice4':

w_word=open('words.txt','w')

json.dump(data,w_word)

break


w_word.close()

r_word.close()

##2

Output for 2nd Query

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.