if __name__ == '__main__':
    klist = [
        "good ", "good ", "study",
        " good ", "good", "study ",
        "good ", " good", " study",
        " good ", "good", " study ",
        "good ", "good ", "study",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
    ]
    # 1.编写Python程序判断字符串是否重复

    nlist = [i.strip() for i in klist]

    klen = len(klist)
    nlen = len(nlist)

    if klen==nlen :
        print("无重复")
    else :
        print("有重复")

    # 2.编写Python程序打印输出字符串中重复的所有字符。

    nset = set(nlist)

    for i in nset :
        num = nlist.count(i)
        if num>1 :
            print(str(i)+"重复了")

    #3.把下面的klist作为字典的键
    #同时作为字典的值

    ndict = {i:i for i in nset}
    print(ndict)

    # 4. 把下面的klist作为字典的键
    # 并统计每个单词的词频

    mdict = {}

    for i in sorted(nset) :
        mdict[i] = nlist.count(i)
    print(mdict)











723d83db197ff01a76dab76683940a0645c4e284
<mask token>

if __name__ == '__main__':
    klist = ['good ', 'good ', 'study', ' good ', 'good', 'study ', 'good ',
        ' good', ' study', ' good ', 'good', ' study ', 'good ', 'good ',
        'study', ' day ', 'day', ' up', ' day ', 'day', ' up', ' day ',
        'day', ' up', ' day ', 'day', ' up', ' day ', 'day', ' up', ' day ',
        'day', ' up', ' day ', 'day', ' up']
    nlist = [i.strip() for i in klist]
    klen = len(klist)
    nlen = len(nlist)
    if klen == nlen:
        print('无重复')
    else:
        print('有重复')
    nset = set(nlist)
    for i in nset:
        num = nlist.count(i)
        if num > 1:
            print(str(i) + '重复了')
    ndict = {i: i for i in nset}
    print(ndict)
    mdict = {}
    for i in sorted(nset):
        mdict[i] = nlist.count(i)
    print(mdict)

if __name__ == '__main__':
    klist = [
        "good ", "good ", "study",
        " good ", "good", "study ",
        "good ", " good", " study",
        " good ", "good", " study ",
        "good ", "good ", "study",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
        " day ", "day", " up",
    ]
    # 1.编写Python程序判断字符串是否重复

    nlist = [i.strip() for i in klist]

    klen = len(klist)
    nlen = len(nlist)

    if klen==nlen :
        print("无重复")
    else :
        print("有重复")

    # 2.编写Python程序打印输出字符串中重复的所有字符。

    nset = set(nlist)

    for i in nset :
        num = nlist.count(i)
        if num>1 :
            print(str(i)+"重复了")

    #3.把下面的klist作为字典的键
    #同时作为字典的值

    ndict = {i:i for i in nset}
    print(ndict)

    # 4. 把下面的klist作为字典的键
    # 并统计每个单词的词频

    mdict = {}

    for i in sorted(nset) :
        mdict[i] = nlist.count(i)
    print(mdict)










