Here is some code that prints out the value of a dictionary based on the key, I have tried some methods like .remove() but can't find a good solution that does not require an entire class to strip the dictionary.
Here is my code:
def WriteoutLines(TheDict, choice):
DictValues = TheDict.copy()
Result = TheDict.get(choice)
print(Result)
TheDict = {"pres": ["the President right now is",
"Joe Biden"],
"FSUNick": ["the seminoles",
"unconquerd"],
"class": ["introcution to Python"]
}
TheKeys = list(TheDict.keys())
Done = False
while (not Done):
print("we have these keys")
for i in range(0, len(TheKeys)):
print(TheKeys[i])
print("enter zz to end program or the word you want a listing for")
choice = input("enter the string you want typed out")
if (choice in TheDict.keys()):
WriteoutLines(TheDict, choice)
elif (choice == "zz"):
break
else:
print("The was not a legal choice")