{"id":3418,"date":"2022-11-26T14:07:05","date_gmt":"2022-11-26T14:07:05","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=3418"},"modified":"2022-11-26T14:07:06","modified_gmt":"2022-11-26T14:07:06","slug":"python-set-issuperset","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/python-set-issuperset\/","title":{"rendered":"Python Set issuperset() Method with examples"},"content":{"rendered":"<p style=\"text-align: center;\">Python Set issuperset<\/p>\n<p>Now, we are going to learn about the issuperset method. If you are already familiar with what is a superset, then it would be just easy for you, to get the concept, but even if you are new to the concept, do not worry, since we would consider the concept from the basics, so you can follow along.<\/p>\n<p>Let\u2019s consider that there are two sets, set1, and set2. Now, we say that set1 is the superset of set2, if all the elements from set2, are there in set1. For example, if set1 = {1, 2, 3, 4, 5} and set2 = {1, 2, 3}, then since the set1 contains all the elements from the set2, the set1 is the superset of set2.<\/p>\n<h2 style=\"text-align: center;\">Python Set issuperset() Method<\/h2>\n<p>Let\u2019s have a look at a simple program, which demonstrates the same thing here.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3419 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-issuperset-METHOD.jpg\" alt=\"\" width=\"650\" height=\"103\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-issuperset-METHOD.jpg 650w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-issuperset-METHOD-300x48.jpg 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>As you can see in the above program, we have two sets, set1, and set2. Then we are trying to check if set1 is the superset of set2. And the answer that we are going to get is going to be True, or False. It is true in our case, since all the elements that are in the set2, are there in the set1, so the set1 is the superset of the set2. So, if you try to execute the above program and observe the output, you can simply find that the output comes out to be True.<\/p>\n<p>Again, Let\u2019s consider one more example, where set1 is not a superset of set2. This is the condition, when all the elements from set2, are not there in set1. Let\u2019s see the sets, and you would get the concept soon.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3420 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-issuperset-METHOD-1.jpg\" alt=\"\" width=\"646\" height=\"89\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-issuperset-METHOD-1.jpg 646w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-issuperset-METHOD-1-300x41.jpg 300w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/p>\n<p>As you can see in the above program, we have two sets again, and this time, if we observe the two sets, then we can find that the set1 is not the superset of set2, since all the elements from the set2, are not there in the set1. So, if you try to execute the above program, you can simply find that the output is False.<\/p>\n<p>So, this way, whenever we need to find whether or not, some set is a superset of another set, we can make use of the issuperset method. Remember that this method is going to return True or False, based on whether the set is a superset of another set or not. You can store the returned value somewhere, but since we were more interested in the output, we printed it directly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Set issuperset Now, we are going to learn about the issuperset method. If you are already familiar with what is a superset, then it would be just easy for you, to get the concept, but even if you are new to the concept, do not worry, since we would consider the concept from the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[26,27],"class_list":{"0":"post-3418","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-python-tutorial","7":"tag-python","8":"tag-python-tutorial"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=3418"}],"version-history":[{"count":2,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3418\/revisions"}],"predecessor-version":[{"id":4116,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3418\/revisions\/4116"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=3418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=3418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=3418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}