Skip to content

Commit b13afe5

Browse files
authoredAug 3, 2021
Merge pull request #93 from senay21/patch-1
Update dictionary.py
2 parents b503bde + 51b353b commit b13afe5

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed
 

‎dictionary.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,53 @@ def __init__(self, word, meaning):
99

1010
def add_new(self):
1111
dictionary[self.word] = self.meaning
12-
print "Word Successfully Added"
12+
print ("Word Successfully Added")
1313

1414
def delete_word(self):
1515
try:
1616
del dictionary[self.word]
17-
print "Word Successfully Deleted"
17+
print ("Word Successfully Deleted")
1818
except KeyError:
19-
print "The Word Does Not Exist in Dictionary. Try Again!"
19+
print "(The Word Does Not Exist in Dictionary. Try Again!")
2020

2121
def edit_word(self):
2222
try:
2323
dictionary[self.word] = self.meaning
24-
print "Word Was Successfully Edited"
24+
print ("Word Was Successfully Edited")
2525
except KeyError:
26-
print "The Word You Trying To Edit Does Not Exist in Dictionary!"
26+
print ("The Word You Trying To Edit Does Not Exist in Dictionary!")
2727

2828
def view_word(self):
2929
try:
30-
print dictionary[self.word]
30+
print (dictionary[self.word])
3131
except KeyError:
32-
print "The Word is not in Dictionary."
32+
print ("The Word is not in Dictionary.")
3333

3434
def view_all(self):
3535
for i in dictionary.keys():
36-
print(i + " : " + dictionary[i])
36+
print(f"{i} : {dictionary[i]}")
3737

3838
def start():
39-
get_op = raw_input("Add, Delete, Edit, View, View all : ")
39+
get_op = input("Add, Delete, Edit, View, View all : ")
4040
if get_op in ["add", "Add"]:
41-
get_word = raw_input("Word to add : ")
42-
get_meaning = raw_input("Meaning : ")
41+
get_word = input("Word to add : ")
42+
get_meaning = input("Meaning : ")
4343
new = Dict(get_word, get_meaning)
4444
new.add_new()
4545

4646
elif get_op in ["delete", "Delete"]:
47-
get_word_to_del = raw_input("Word to delete : ")
47+
get_word_to_del = input("Word to delete : ")
4848
delete = Dict(get_word_to_del, None)
4949
delete.delete_word()
5050

5151
elif get_op in ["edit", "Edit"]:
52-
get_word_to_edit = raw_input("Word to edit : ")
53-
get_new_meaning = raw_input("New meaning : ")
52+
get_word_to_edit = input("Word to edit : ")
53+
get_new_meaning = input("New meaning : ")
5454
mean = Dict(get_word_to_edit, get_new_meaning)
5555
mean.edit_word()
5656

5757
elif get_op in ["view", "View"]:
58-
get_word_to_view = raw_input("Word to view : ")
58+
get_word_to_view = input("Word to view : ")
5959
view = Dict(get_word_to_view, None)
6060
view.view_word()
6161

@@ -64,14 +64,14 @@ def start():
6464
nothing.view_all()
6565

6666
else:
67-
print "Invalid Input. Try again!"
67+
print ("Invalid Input. Try again!")
6868

6969
def end():
7070
quit()
7171

7272
def main():
7373
while True:
74-
s_or_e = raw_input("Start or End : ")
74+
s_or_e = input("Start or End : ")
7575
if s_or_e == "Start":
7676
start()
7777
print(" ")
@@ -82,4 +82,4 @@ def main():
8282

8383

8484
if __name__ == "__main__":
85-
main()
85+
main()

0 commit comments

Comments
 (0)
Failed to load comments.