#!/usr/bin/python # : = ( - ) # = ( ) A = ('a', 'b', 'c') B = ('c', 'd') C = ('d', 'e') D = () # # , ( OR ) inSet1 == inSet2 # , not ( OR ) def intersection_of_sets(set1, set2): pm = False for inSet1 in set1: for inSet2 in set2: if inSet1 == inSet2: #print(' : ', inSet1, '=', inSet2) pm = True #else: print(' , .. ') if pm == True: print(' ') else: print(' ') return pm # intersection_of_sets(A, B) # True: intersection_of_sets(A, C) # False: - #.. # intersection_of_sets(D, D) # False: # , .. #. , =
Source: https://habr.com/ru/post/328236/
All Articles