解决此问题时遇到问题。这是我的答案

时间:2019-11-21 06:32:57

标签: python

def is_in_both_lists(list1, list2):
    ## TODO
    ## Complete this function such that if any item in list1 is also in list2, return True, otherwise False

    arr = np.arange(is_in_both_lists)
    arr = 6
    return True

print(is_in_both_lists(list1, list2))

1 个答案:

答案 0 :(得分:1)

看起来更好=)

def is_in_both_lists(list1, list2):
    ## TODO
    ## Complete this function such that if any
    ## item in list1 is also in list2, return True, otherwise False

    return any( i in list2 for i in list1 )