Copy the following code into your IDE
terms = {"bit":"binary digit", "byte":"8 Bits", "kilobyte":"1000 Bytes"}
def Main():
# The input output loop
ans = ""
while ans != "end":
print("L to Look up a Word")
print("E to Enter new Word")
print("end to exit the program")
ans = input("What do you want to do?")
if ans == "L":
lookup()
elif ans == "E":
enter()
else:
print("I don't understand that command")
def lookup():
word = input("Enter the word you wish to look up")
if word in terms:
print(terms.get(word))
else:
print("Word not in dictionary")
def enter():
word = input("Enter new word")
definition = input("Enter the definition")
terms[word] = definition
Main()
Revision Helper Exercise
- Run the above code. Make sure you understand how it works
- Follow the link to see Computing Key Terms. Add some of these to your dictionary.
- Add an option to the Main() loop to print out all the key values in the terms dictionary. Implement that option