Source Code:
(back to article)
def get_key(wörterbuch, wert): for schlüssel, val in wörterbuch.items(): if val == wert: return schlüssel return None mein_dict = {'a': 1, 'b': 2, 'c': 3} print(get_key(mein_dict, 2)) # Ausgabe: 'b'
Result:
Report an issue