1.代码如下:
result_dict={'Allen': ['red', 'blue', 'yellow'],'Tom': ['green', 'white', 'blue'],'Andy': ['black', 'pink']}
for i in sorted(result_dict):
    print(f"{i}'s favorite colors are:")
    for j in (result_dict[i]):
        print(j)
2.思路:两个循环
step1:外循环遍历键,并格式化输出。
step2:内循环遍历值,在这里等同于列表的遍历。