Project 1 - English Dictionary App & Library Book Management System
Project Title: English Dictionary Application
Project Description: The English Dictionary Application is a Python-based software project that aims to provide users with an intuitive and efficient way to look up the meanings of English words. This project employs the concepts and skills learned in weeks 1 to 6 of Python programming.
The application features a user-friendly menu interface with four options - adding a new word, finding the meaning of a word, updating a word, and exiting the program. Upon selecting an option, the application prompts the user for the necessary input and performs the corresponding action.
When the user chooses to add a new word, the application prompts for the word and its corresponding meaning and stores them in a file called 'words.txt'. If the user wants to find the meaning of a word, the application prompts for a word to search in the 'words.txt' file. If the word is found, the application displays the corresponding meaning; otherwise, it returns an appropriate message. In the case of updating a word, the application prompts for a word and its new meaning updates the dictionary, and returns to the main menu.
The application stores the dictionary using the concept of serialization, where the words and their meanings are stored in 'words.txt' in a serialized format. If the user chooses to exit the program, the application gracefully terminates.
By completing this project, students can practice and enhance their Python programming skills while creating a useful and practical application that can be added to their professional portfolio.
import json
print('Welcom to the English Dictionary App!!')
print('Please select your choice...')
print('1 to Add a new number')
print('2 to Find the meaning of the word')
print('3 to Update a word')
print('4 to Exit')
f = open('words.txt','w')
dict = {}
json.dump(dict,f)
f.close()
while True:
n = int(input('Please Enter a number : '))
if n == 1:
import json
f = open('words.txt','w')
w = input('Enter the word which you want to add : ')
m = input('Enter the meaning of the word : ')
dict[w] = m
json.dump(dict,f)
f.close()
elif n == 2:
import json
f = open('words.txt','r+')
dict=json.load(f)
find = input('Enter the word which you want to find : ')
if find in dict:
print('The meaning of the word is : ',dict.get(find))
else:
print('We are Sorry, The word is not found!!')
print('Find another word')
elif n == 3:
import json
f = open('words.txt','w')
u = input('Enter the word which you want to update : ')
u_m = input('Enter the meaning of the word : ')
dict[u] = u_m
json.dump(dict,f)
f.close()
elif n == 4:
print('Do you want to exit from the dictionary..!!')
print('Plese enter Yes or No')
a = input("Enter Yes/No to continue : ")
if a=="Yes":
print('Thank You for Choosing our Dictionary..')
print('__'*20)
break
elif a=="No":
print('Once again Welcome to the Dictionary....')
continue
else:
print(" Invalid input!!.. Please,Enter either Yes/No")
print('__'*20)
else:
print('Invalid Input!!!... Please choose a number given from above..')
print('__'*10)