On May 2, 2016 5:27 PM, "Jason N. via Tutor" <tutor@python.org> wrote:
>
> Hello,
> Wanted to ask if its possible to have a dictionary that can be looked up
by either values?
> For example,
> mydic = {"A: "Apple", "B": "Banana"}When user inputs "A" I want "Apple"
to come. But if the user enter "Apple" I want "A" to respond.
I think this would depend on how big the data set is and how often you want
to look things up.
Two other Solutions:
Create a class which internally manages two dictionaries.
If things are really big create a database using for example sqlite.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to