votes up 2

Input args to Union must be Sets

github stars 8356
Exception Class:

Raise code

    # ===== Global Rules =====
    if not args:
        return S.EmptySet

    for arg in args:
        if not isinstance(arg, Set):
            raise TypeError("Input args to Union must be Sets")

    # Merge all finite sets
    finite_sets = [x for x in args if x.is_FiniteSet]
    if len(finite_sets) > 1:
        a = (x for set in finite_sets for x in set)
        finite_set = FiniteSet(*a)
        args = [finite_set] + [x for x in args if not x.is_FiniteSet]
😲  Walkingbet is Android app that pays you real bitcoins for a walking. Withdrawable real money bonus is available now, hurry up! 🚶

Ways to fix

votes up 0 votes down

def Union(a,b):

    if a == True and b == True:

        return True

    return False

A = True

B = True

C = True

D = True

E = True

A_B = Union (A, B)

C_D = select (C,D)

C_D_E = select(C_D,E)

ab = Union(A_B,C_D_E)


Jul 11, 2022 Nguynt answer
Nguynt 502

Add a possible fix

Please authorize to post fix