sort the dictionary in python
d = {2: 3, 1: 89, 4: 5, 3: 0}
od = sorted(d.items())
print(od)
sort the dictionary in python
d = {2: 3, 1: 89, 4: 5, 3: 0}
od = sorted(d.items())
print(od)
sort a dictionary
from operator import itemgetter
new_dict = sorted(data.items(), key=itemgetter(1))
how to sort a dictionary
markdict = {"Tom":67, "Tina": 54, "Akbar": 87, "Kane": 43, "Divya":73}
marklist = sorted(markdict.items(), key=lambda x:x[1])
sortdict = dict(marklist)
print(sortdict)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us