if __name__ == '__main__':
#通过列表创建
name = ['《Give up , hold on to me》',
'《The private dishes of the husbands》',
'《My father-in-law will do martiaiarts》',
'《North Canton still believe in love》'
'《Impossible task》'
'《Sparrow》'
'《East of dream Avenue》'
'《The prodigal son of the new frontier town》'
'《Distant distance》'
'《Music legend》']
rating = [1.4,1.343,0.92,0.862,0.553,0.411,0.164,0.259,0.394,0.562]
#将电视剧的名字和收视率保存为字典,用zip()函数将收视率和名称一一对应
TV = dict(zip(rating,name))
#使用sorted()函数对字典TV的元素按照收视率的降序进行排序:TV.items()元组列表
sort = sorted(TV.items(), reverse=True)#False,升序排序。
#打印电视剧的收视率排行榜
print("按收视率排序:",sort)