09.模块与datatime模块

09.模块与datatime模块

题目说明:了解Collection模块,编写程序以查询给定列表中最常见的元素。

输入:language = [‘PHP’, ‘PHP’, ‘Python’, ‘PHP’, ‘Python’, ‘JS’, ‘Python’, ‘Python’,‘PHP’, ‘Python’]

输出:Python

language = ['PHP', 'PHP', 'Python', 'PHP', 'Python', 'JS', 'Python', 'Python','PHP', 'Python']
def most_element(language):
    """ Return a list of lines after inserting a word in a specific line. """
    
    x = 0
    l = set(language)
    for i in l:
        if language.count(i) > x:
            x = language.count(i)
            re = i

    return re


print(most_element(language))
#Python

©️2020 CSDN 皮肤主题: 1024 设计师:上身试试 返回首页