sort a list within a dictionary in python?

I have a dictionary, that contains keys, “name” and then values as lists “score”. I need to be able to sort into:

  • in alphabetical order with the highest value for each “name”
  • by highest score, highest to lowest
  • by average, “mean”, score, highest to lowest

    if group == "C":
         if name in groupC:
             groupC = pickle.load(open("groupC.p", "rb"))
             score = [count]
             groupC[name].append(count)
             if len(groupC[name]) > 3:
                 print("Deleting oldest score.")
                 groupC[name].pop(0)
             pickle.dump(groupC, open("groupC.p", "wb"))
        else:
            score = [count]
            groupC[name] = [count]
            pickle.dump(groupC, open("groupC.p", "wb"))
    
    print("You have completed the test. You got a score of", count,", well done!")
    
     if menu_choice == 2:
    classchoice = input("What class would you like to look at? ")
    if classchoice == "A":
        groupA = pickle.load(open("groupA.p", "rb"))
        print(groupA)
    if classchoice == "B":
        groupB = pickle.load(open("groupB.p", "rb"))
        print(groupB)
    if classchoice == "C":
        groupC = pickle.load(open("groupC.p", "rb"))
        print(groupC)
    

i have no idea how this could be done, especially as the list is in the dictionary, could someone help please? thank you!


Download sort.a.list.within.a.dictionary.in.python.zip
Direct Link


Download


Download sort.a.list.within.a.dictionary.in.python.zip
Mediafire


Download


Download sort.a.list.within.a.dictionary.in.python.zip
mirror creator


Download


Download sort.a.list.within.a.dictionary.in.python.zip
KeepFile


Download


Download sort.a.list.within.a.dictionary.in.python.zip
Queenshare


Download

Both comments and pings are currently closed.

Comments are closed.