Looping melalui dikt. dan mengembalikan kunci dengan nilai tertinggi
dict1 = {"a": 18, "x": 2, "y": 3, "z": 10}
key_with_the_highest_value = list(dict1.keys())
for keys, values in (dict1.copy()).items():
for values2 in (dict1.copy()).values():
if values >= values2:
continue
if values < values2:
key_with_the_highest_value.remove(keys)
break
print(f"The key with the highest value is: {key_with_the_highest_value}")
# SIMPLIFIED ANSWER WITHOUT LOOPING
# print(max(dict1.keys()))
OHIOLee