@@ -9,53 +9,53 @@ def __init__(self, word, meaning):
9
9
10
10
def add_new (self ):
11
11
dictionary [self .word ] = self .meaning
12
- print "Word Successfully Added"
12
+ print ( "Word Successfully Added" )
13
13
14
14
def delete_word (self ):
15
15
try :
16
16
del dictionary [self .word ]
17
- print "Word Successfully Deleted"
17
+ print ( "Word Successfully Deleted" )
18
18
except KeyError :
19
- print "The Word Does Not Exist in Dictionary. Try Again!"
19
+ print "( The Word Does Not Exist in Dictionary. Try Again!" )
20
20
21
21
def edit_word (self ):
22
22
try :
23
23
dictionary [self .word ] = self .meaning
24
- print "Word Was Successfully Edited"
24
+ print ( "Word Was Successfully Edited" )
25
25
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!" )
27
27
28
28
def view_word (self ):
29
29
try :
30
- print dictionary [self .word ]
30
+ print ( dictionary [self .word ])
31
31
except KeyError :
32
- print "The Word is not in Dictionary."
32
+ print ( "The Word is not in Dictionary." )
33
33
34
34
def view_all (self ):
35
35
for i in dictionary .keys ():
36
- print (i + " : " + dictionary [i ])
36
+ print (f" { i } : { dictionary [i ]} " )
37
37
38
38
def start ():
39
- get_op = raw_input ("Add, Delete, Edit, View, View all : " )
39
+ get_op = input ("Add, Delete, Edit, View, View all : " )
40
40
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 : " )
43
43
new = Dict (get_word , get_meaning )
44
44
new .add_new ()
45
45
46
46
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 : " )
48
48
delete = Dict (get_word_to_del , None )
49
49
delete .delete_word ()
50
50
51
51
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 : " )
54
54
mean = Dict (get_word_to_edit , get_new_meaning )
55
55
mean .edit_word ()
56
56
57
57
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 : " )
59
59
view = Dict (get_word_to_view , None )
60
60
view .view_word ()
61
61
@@ -64,14 +64,14 @@ def start():
64
64
nothing .view_all ()
65
65
66
66
else :
67
- print "Invalid Input. Try again!"
67
+ print ( "Invalid Input. Try again!" )
68
68
69
69
def end ():
70
70
quit ()
71
71
72
72
def main ():
73
73
while True :
74
- s_or_e = raw_input ("Start or End : " )
74
+ s_or_e = input ("Start or End : " )
75
75
if s_or_e == "Start" :
76
76
start ()
77
77
print (" " )
@@ -82,4 +82,4 @@ def main():
82
82
83
83
84
84
if __name__ == "__main__" :
85
- main ()
85
+ main ()
0 commit comments