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]
😲 Agile task management is now easier than calling a taxi. #Tracklify
🙏 Scream for help to Ukraine
Today, 14th August 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too! We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.

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