+ 1

How??

Let dit={1:'a',3:'b',2:'c'} Now if I use print(dit[1]) I get 'a', But what if I want to enter the value 'b' and get 3.

6th Aug 2019, 5:26 PM
Akash
Akash - avatar
1 Answer
+ 3
The keys in a dictionary are unique, but the values don't have to be. So you can have in the same dictionary also 4:'b' and 77:'b' For this reason there is no straightforward answer but you can find a few ways how to solve this, here: https://www.google.com/amp/s/www.geeksforgeeks.org/JUMP_LINK__&&__python__&&__JUMP_LINK-get-key-from-value-in-dictionary/amp/
6th Aug 2019, 5:31 PM
Tibor Santa
Tibor Santa - avatar