“Suchwörterbuch nach Wert” Code-Antworten

Suchwörterbuch nach Wert

mydict = {'george':16,'amber':19}
res = dict((v,k) for k,v in mydict.items())
print(res[16]) # Prints george

print(res.get(16))
Jittery Jay

Suche im Diktat Python

dictionary = { "key1" : 1, "name" : "Jordan", "age" : 21 }
for key in dictionary.keys():
    print("the key is {} and the value is {}".format(key, dictionary[key]))
    # or print("the key is",key,"and the value is",dictionary[key])
# OUTPOUT
# the key is key1 and the value is 1
# the key is name and the value is Jordan
# the key is age and the value is 21
Sevrobe

Ähnliche Antworten wie “Suchwörterbuch nach Wert”

Fragen ähnlich wie “Suchwörterbuch nach Wert”

Weitere verwandte Antworten zu “Suchwörterbuch nach Wert” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen