可以参考一下:
cj = {"w": 90, "z": 67, "h": 45, "zh": 78, "j": 89, "p": 87, "sh": 79, "t": 67, "ff": 56, "ti": 67}
# list1 = cj.keys()
# list2 = cj.values()
list1 = []
list2 = []
for keys, values in cj.items():
list1.append(keys)
list2.append(values)
# print(list1)
# print(list2)
for i in range(0, 10):
for n in range(0, 9):
if list2[n] > list2[n + 1]:
temp1 = list1[n]
list1[n] = list1[n + 1]
list1[n + 1] = temp1
temp2 = list2[n]
list2[n] = list2[n + 1]
list2[n + 1] = temp2
print("成绩排列为:", list2)
for i in range(0, 10):
print(list1[i], ":", list2[i], ";", )