{"id":12890,"date":"2021-10-01T11:00:34","date_gmt":"2021-10-01T05:30:34","guid":{"rendered":"https:\/\/python-programs.com\/?p=12890"},"modified":"2021-11-22T18:33:27","modified_gmt":"2021-11-22T13:03:27","slug":"python-program-to-union-of-set-of-tuples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-union-of-set-of-tuples\/","title":{"rendered":"Python Program to Union of Set of Tuples"},"content":{"rendered":"

In this tutorial, we will learn how to calculate the union of sets of tuples in Python. Let us begin by defining the union in set theory.
\nThe set of every element in the collection of sets is the set of the union of sets. In the case of duplicate elements in different sets, the final union will only contain the specific element once. The letter \u2018U’ represents the union.
\nThis problem is centered on finding the union of sets of tuples, which indicates that the set is made up of tuple elements.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

first = {('hello', 5), ('this', 100)}\r\nsecond = {('this', 100), ('is', 200)}\r\nthird = {('hello', 5), ('btechgeeks', 461), ('python', 234)}<\/pre>\n

Output:<\/strong><\/p>\n

first Union Second =  {('is', 200), ('this', 100), ('hello', 5)}\r\nSecond Union third =  {('python', 234), ('is', 200), ('this', 100), ('hello', 5), ('btechgeeks', 461)}\r\nfirst Union Second Union third =  {('python', 234), ('is', 200), ('this', 100), ('hello', 5), ('btechgeeks', 461)}<\/pre>\n

Program to Union of Set of Tuples in Python<\/h2>\n

Below are the ways to find the union of the set of tuples in Python.<\/p>\n