I want to have the user use input to call variables from a dictionary but I would like a way to check if the value doesn't exist.
example:
dictionary = {'a': 1, 'b': 2, 'c': 3}
chosen = raw_input("choose one:")
if(dictionary[chosen] == true):
print(chosen)
else: print("Invalid choice")
When I run something like this is always defaults to the else
clause. Why is this?