Python‎ > ‎frozenset‎ > ‎

frozenset.union()

http://www.adilwaseem.com/

Introduction
Return the union of sets as a new set.

Syntax
frozenset.union()

Parameters
iterable

Examples
The Response returns the union of frozenset x, y. 

def frozenset1(request):
    x=frozenset({7,9,11,13})
    y=frozenset({5,10,15})
    z=frozenset.union(x,y)
    z=str(z)
    return Response('The union of frozenset is:' + z)
        
if __name__ == '__main__':
    config = Configurator()
    config.add_route('set', '/')
    config.add_view(frozenset1, route_name='set')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 1050, app)
    server.serve_forever()






The method return with unity between the sets.
 x=frozenset({1,3,4,5})
y=frozenset({3,4,6})
z=frozenset.union(x,y)
print(z)

>>> 
frozenset({1, 3, 4, 5, 6})
>>>

Comments