Given an array of integers Python, it determines whether there is a repeating element.

If no value occurs twice in the array, the function returns true, if each element of each array are not the same, false is returned.

eg: Input: [4, 1]

        Output: true

        Input: [1,2,3,4]

        Output: false

------------------------------------------------------------------------------------------------------------------------------------------------

def num(a):
    if len(set(a)) == len(a):
        print(False)
    else:
        print(True)
    

 

Published 35 original articles · won praise 26 · views 80000 +

Guess you like

Origin blog.csdn.net/weixin_42342968/article/details/99710771
Recommended