{"id":4171,"date":"2020-08-22T17:50:38","date_gmt":"2020-08-22T17:50:38","guid":{"rendered":"https:\/\/tutorialsclass.com\/?p=4171"},"modified":"2020-08-22T17:50:40","modified_gmt":"2020-08-22T17:50:40","slug":"python-sets","status":"publish","type":"post","link":"https:\/\/tutorialsclass.com\/python-sets\/","title":{"rendered":"Python Sets"},"content":{"rendered":"\n<p>Python Sets are the collection of multiple data like the list and tuple. The main difference between the list and the Python Sets is that the set elements are unordered and unindexed. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Declaration of Python sets<\/h4>\n\n\n\n<p class=\"lang:python\"><code>set_name={'a','d','e'}<\/code> <\/p>\n\n\n\n<p>We can also create the set by using a set constructor such as <code>set_name=set(('a','d','e')) <\/code><\/p>\n\n\n\n<p>In python programming, sets are written with the help of curly braces <code>{}<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Printing a set<\/h3>\n\n\n\n<p>Printing a set is simple like printing a variable. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example of printing a set<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {\"PHP\", \"Python\", \"Java\"}\nprint(my_set)<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n{&#8216;PHP&#8217;, &#8216;Java&#8217;, &#8216;Python&#8217;}<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Topics to remember about Python Sets<\/strong><\/h2>\n\n\n\n<p>Sets in Python are unordered and have a definite count. We can concatenate the sets, so many things.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Printing a specific element from the sets<\/h3>\n\n\n\n<p>We can&#8217;t print the specific value from the set by specifying an index. Because set elements don&#8217;t have a specific order and index.<br>But we can do the so by using condition statement. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to print a specific element from the set using conditional statement<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>letter_set = {'PHP','Python','Java'}\ncheck_element = 'PHP'\nif check_element in letter_set:\n    output = check_element\n    print(output)<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\nPHP<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Modifying or updating elements of a set<\/h3>\n\n\n\n<p>We can&#8217;t modify element from the set directly. If we try to do the so, then python will show the error.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = (\"PHP\", \"Python\", \"java\")\nmy_set&#091;0] = \"JavaScript\"\nprint(my_set)<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\nTraceback (most recent call last):<br \/>\n  File &#8220;even.py&#8221;, line 2, in<br \/>\n    my_set[0] = &#8220;JavaScript&#8221;<br \/>\nTypeError: &#8216;set&#8217; object does not support item assignment<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Python Sets &#8211; Adding elements to a set<\/h3>\n\n\n\n<p>We can add any number of elements in set directly by using some inbuilt functions.<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to add a single element to the set using add() function <\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_Set = {\"PHP\", \"Java\", \"Python\"}\n# by using add() function, we can add the single element to the set in Python\nmy_Set.add(\"JQuery\")\nprint(my_Set)<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n{&#8216;PHP&#8217;, &#8216;Python&#8217;, &#8216;JQuery&#8217;, &#8216;Java&#8217;}<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<h4 class=\"wp-block-heading\">Example to add multiple elements to the set using update() function<\/h4>\n\n\n\n<pre id=\"block-c6bb9dfd-4313-4d8b-91b6-ea67e5e58598\" class=\"wp-block-code language-python\"><code># by the help of the update() function , we can add multiple elements to the set.\nmy_Set.update(&#091;\"JavaScript\", \"CSS\", \"HTML\"])\nprint(my_Set)<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n{&#8216;PHP&#8217;, &#8216;HTML&#8217;, &#8216;Python&#8217;, &#8216;Java&#8217;, &#8216;CSS&#8217;, &#8216;JavaScript&#8217;, &#8216;JQuery&#8217;}<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Copying one set to the other Set<\/h3>\n\n\n\n<p>We can easily copy one set to the other by using the copy() method. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to copy one set to other<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>set_1 = {\"PHP\", \"Java\", \"Python\"}\nset_2 = set_1.copy()\nprint(set_2)<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n{&#8216;Java&#8217;, &#8216;Python&#8217;, &#8216;PHP&#8217;}<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Checking length of a Python set:<\/h3>\n\n\n\n<p>With the help of <code>len()<\/code> function we can check the length of the set. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to calculate the length of a set<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {'T','u','t','o','r','i','a','l','s','C','l','a','s','s'}\nprint(len(my_set))<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n10<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<h5 class=\"wp-block-heading\">Description of output<\/h5>\n\n\n\n<p>Here you can see the output is10, but the number of elements are 14. This is because set doesn&#8217;t consider duplicate values. If a value is present multiple times, then it will be considered only one time in Python Set.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Removing the specific element from the set<\/h3>\n\n\n\n<p>With the help of <code>discard()<\/code> function, we can remove the specific element from the set. This function will delete both the uppercase and lowercase values(similar to the argument) from the set.<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to remove specific element from the set<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {'T','u','t','o','r','i','a','l','s','C','l','a','s','s'}\nmy_set.discard('t')\nprint(my_set)<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n{&#8216;u&#8217;, &#8216;C&#8217;, &#8216;T&#8217;, &#8216;s&#8217;, &#8216;i&#8217;, &#8216;l&#8217;, &#8216;r&#8217;, &#8216;a&#8217;, &#8216;o&#8217;}<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<h5 class=\"wp-block-heading\">Description of output<\/h5>\n\n\n\n<p>This function will delete both the uppercase and lowercase values from the set.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Python Sets &#8211; Deleting a set<\/h3>\n\n\n\n<p>In Python programming, we can delete the whole set as well. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to delete the whole set<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {\"apple\", \"banana\", \"cherry\"}\ndel my_set<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Description of output<\/h5>\n\n\n\n<p>Here you can see that the output is blank because we have deleted the set. So, it will not return anything.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Removing elements from the set using clear() function<\/h3>\n\n\n\n<p>We can also delete the elements of the set by using a <code>clear()<\/code> function. The main difference between the clear and <code>delete()<\/code> is that clear delete all elements while <code>delete()<\/code> deletes the set completely.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {'T','u','t','o','r','i','a','l','s','C','l','a','s','s'}\nprint(my_set.clear())<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\nmy_set={}<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<h5 class=\"wp-block-heading\">Description of output<\/h5>\n\n\n\n<p>This is will make the set none.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Checking if any item exists in Python set<\/h3>\n\n\n\n<p>Like list, we can easily check if a element is present in the set or not. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to check a element is existing in the set or not<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {\"Ramesh\", \"Suresh\", \"Rakesh\"}\nif \"Ramesh\" in my_set:\n  print(\"Yes, 'Ramesh' is in this set\")\nelse:\n   print(\"No, 'Ramesh' is not in this set\")<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\nYes, &#8216;Ramesh&#8217; is in this set<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Finding the maximum value in the set<\/h3>\n\n\n\n<p>Like the list, we can also find the maximum value in a set by using max() function.<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to find out the maximum value from the set<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {1,2,2,1,2,3}\nprint(max(my_set))<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n3<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Finding the minimum value in the set<\/h3>\n\n\n\n<p>With the help of the min() we can also find the minimum value in a set.<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to find out the minimum value from the set<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {1,2,2,1,2,3}\nprint(min(my_set))<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n1<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Finding the sum of values in the set<\/h3>\n\n\n\n<p>We can easily the sum of all the values of a set by using sum() method.<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to calculate the sum of set elements<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {1,2,2,1,2,3}\nprint(sum(my_set))<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n6<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<h5 class=\"wp-block-heading\">Description of output<\/h5>\n\n\n\n<p>Here you can see that the sum is 6, because set doesn&#8217;t consider duplicate values. If a value is present multiple times, then it will be considered only one time in Python Set.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Python Sets &#8211; Finding the average of elements<\/h3>\n\n\n\n<p>Like the list, we can calculate the average easily. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example to calculate the average of the set elements<\/h4>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>my_set = {1,2,2,1,2,3}\nprint(sum(my_set)\/len(my_set))<\/code><\/pre>\n\n\n\t<div class=\"tc-browser-container\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-circle\"><\/span>\r\n\t\t\t<span class=\"tc-browser-title\"> Tutorials Class - Output Window <\/span>\r\n\t\t<\/div>\r\n\t\t<div class=\"tc-browser-content\"> <p>\n2.0<\/p>\n <\/div>\r\n\t<\/div>\r\n\n\n\n\n<h5 class=\"wp-block-heading\">Description of output<\/h5>\n\n\n\n<p>Here you can see that the average is 2, because set doesn&#8217;t consider duplicate values. If a value is present multiple times, then it will be considered only one time in Python Set. (1+2+3)\/3.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n","protected":false},"excerpt":{"rendered":"<p>Python Sets are the collection of multiple data like the list and tuple. The main difference between the list and the Python Sets is that the set elements are unordered and unindexed&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"keywords":[],"class_list":["post-4171","post","type-post","status-publish","format-standard","hentry","category-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Learn Python Sets with Examples - Tutorials Class<\/title>\n<meta name=\"description\" content=\"Python Sets are unordered, unindexed. In this Python Tutorial learn about creating, deleting and updating set elements with examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tutorialsclass.com\/python-sets\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Learn Python Sets with Examples - Tutorials Class\" \/>\n<meta property=\"og:description\" content=\"Python Sets are unordered, unindexed. In this Python Tutorial learn about creating, deleting and updating set elements with examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorialsclass.com\/python-sets\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorials Class\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/tutorialsclass\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-22T17:50:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-22T17:50:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tutorialsclass.com\/wp-content\/uploads\/2020\/07\/tutorials-class-logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Tutorials Class\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@TutorialsClass\" \/>\n<meta name=\"twitter:site\" content=\"@TutorialsClass\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tutorials Class\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/tutorialsclass.com\/python-sets\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/tutorialsclass.com\/python-sets\/\"},\"author\":{\"name\":\"Tutorials Class\",\"@id\":\"https:\/\/tutorialsclass.com\/#\/schema\/person\/f7d4f67fc9721ef3ea91cb21aaf89e3e\"},\"headline\":\"Python Sets\",\"datePublished\":\"2020-08-22T17:50:38+00:00\",\"dateModified\":\"2020-08-22T17:50:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/tutorialsclass.com\/python-sets\/\"},\"wordCount\":862,\"publisher\":{\"@id\":\"https:\/\/tutorialsclass.com\/#organization\"},\"articleSection\":[\"Python Tutorial\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorialsclass.com\/python-sets\/\",\"url\":\"https:\/\/tutorialsclass.com\/python-sets\/\",\"name\":\"Learn Python Sets with Examples - Tutorials Class\",\"isPartOf\":{\"@id\":\"https:\/\/tutorialsclass.com\/#website\"},\"datePublished\":\"2020-08-22T17:50:38+00:00\",\"dateModified\":\"2020-08-22T17:50:40+00:00\",\"description\":\"Python Sets are unordered, unindexed. In this Python Tutorial learn about creating, deleting and updating set elements with examples.\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorialsclass.com\/python-sets\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorialsclass.com\/python-sets\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorialsclass.com\/python-sets\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorialsclass.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learn\",\"item\":\"https:\/\/tutorialsclass.com\/learn\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Tutorial\",\"item\":\"https:\/\/tutorialsclass.com\/learn\/python\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Python Sets\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tutorialsclass.com\/#website\",\"url\":\"https:\/\/tutorialsclass.com\/\",\"name\":\"Tutorials Class\",\"description\":\"Online Tutorials for Beginners\",\"publisher\":{\"@id\":\"https:\/\/tutorialsclass.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tutorialsclass.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/tutorialsclass.com\/#organization\",\"name\":\"Tutorials Class\",\"url\":\"https:\/\/tutorialsclass.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorialsclass.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/tutorialsclass.com\/wp-content\/uploads\/2020\/05\/tutorials-class-logo.png\",\"contentUrl\":\"https:\/\/tutorialsclass.com\/wp-content\/uploads\/2020\/05\/tutorials-class-logo.png\",\"width\":442,\"height\":94,\"caption\":\"Tutorials Class\"},\"image\":{\"@id\":\"https:\/\/tutorialsclass.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/tutorialsclass\",\"https:\/\/x.com\/TutorialsClass\",\"https:\/\/in.pinterest.com\/merientinfotech\/boards\/\",\"https:\/\/www.youtube.com\/channel\/UCzbpQXlqec-bQf1_kwrTuoA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/tutorialsclass.com\/#\/schema\/person\/f7d4f67fc9721ef3ea91cb21aaf89e3e\",\"name\":\"Tutorials Class\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorialsclass.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/346276d8e1600eec36df1bf9adcf78bf1eabb87fc0a79250e0565a88809b8f14?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/346276d8e1600eec36df1bf9adcf78bf1eabb87fc0a79250e0565a88809b8f14?s=96&d=mm&r=g\",\"caption\":\"Tutorials Class\"},\"sameAs\":[\"tcadmin\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Learn Python Sets with Examples - Tutorials Class","description":"Python Sets are unordered, unindexed. In this Python Tutorial learn about creating, deleting and updating set elements with examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/tutorialsclass.com\/python-sets\/","og_locale":"en_US","og_type":"article","og_title":"Learn Python Sets with Examples - Tutorials Class","og_description":"Python Sets are unordered, unindexed. In this Python Tutorial learn about creating, deleting and updating set elements with examples.","og_url":"https:\/\/tutorialsclass.com\/python-sets\/","og_site_name":"Tutorials Class","article_publisher":"https:\/\/www.facebook.com\/tutorialsclass","article_published_time":"2020-08-22T17:50:38+00:00","article_modified_time":"2020-08-22T17:50:40+00:00","og_image":[{"width":600,"height":600,"url":"https:\/\/tutorialsclass.com\/wp-content\/uploads\/2020\/07\/tutorials-class-logo.png","type":"image\/png"}],"author":"Tutorials Class","twitter_card":"summary_large_image","twitter_creator":"@TutorialsClass","twitter_site":"@TutorialsClass","twitter_misc":{"Written by":"Tutorials Class","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/tutorialsclass.com\/python-sets\/#article","isPartOf":{"@id":"https:\/\/tutorialsclass.com\/python-sets\/"},"author":{"name":"Tutorials Class","@id":"https:\/\/tutorialsclass.com\/#\/schema\/person\/f7d4f67fc9721ef3ea91cb21aaf89e3e"},"headline":"Python Sets","datePublished":"2020-08-22T17:50:38+00:00","dateModified":"2020-08-22T17:50:40+00:00","mainEntityOfPage":{"@id":"https:\/\/tutorialsclass.com\/python-sets\/"},"wordCount":862,"publisher":{"@id":"https:\/\/tutorialsclass.com\/#organization"},"articleSection":["Python Tutorial"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/tutorialsclass.com\/python-sets\/","url":"https:\/\/tutorialsclass.com\/python-sets\/","name":"Learn Python Sets with Examples - Tutorials Class","isPartOf":{"@id":"https:\/\/tutorialsclass.com\/#website"},"datePublished":"2020-08-22T17:50:38+00:00","dateModified":"2020-08-22T17:50:40+00:00","description":"Python Sets are unordered, unindexed. In this Python Tutorial learn about creating, deleting and updating set elements with examples.","breadcrumb":{"@id":"https:\/\/tutorialsclass.com\/python-sets\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorialsclass.com\/python-sets\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/tutorialsclass.com\/python-sets\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorialsclass.com\/"},{"@type":"ListItem","position":2,"name":"Learn","item":"https:\/\/tutorialsclass.com\/learn\/"},{"@type":"ListItem","position":3,"name":"Python Tutorial","item":"https:\/\/tutorialsclass.com\/learn\/python\/"},{"@type":"ListItem","position":4,"name":"Python Sets"}]},{"@type":"WebSite","@id":"https:\/\/tutorialsclass.com\/#website","url":"https:\/\/tutorialsclass.com\/","name":"Tutorials Class","description":"Online Tutorials for Beginners","publisher":{"@id":"https:\/\/tutorialsclass.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tutorialsclass.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/tutorialsclass.com\/#organization","name":"Tutorials Class","url":"https:\/\/tutorialsclass.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorialsclass.com\/#\/schema\/logo\/image\/","url":"https:\/\/tutorialsclass.com\/wp-content\/uploads\/2020\/05\/tutorials-class-logo.png","contentUrl":"https:\/\/tutorialsclass.com\/wp-content\/uploads\/2020\/05\/tutorials-class-logo.png","width":442,"height":94,"caption":"Tutorials Class"},"image":{"@id":"https:\/\/tutorialsclass.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/tutorialsclass","https:\/\/x.com\/TutorialsClass","https:\/\/in.pinterest.com\/merientinfotech\/boards\/","https:\/\/www.youtube.com\/channel\/UCzbpQXlqec-bQf1_kwrTuoA"]},{"@type":"Person","@id":"https:\/\/tutorialsclass.com\/#\/schema\/person\/f7d4f67fc9721ef3ea91cb21aaf89e3e","name":"Tutorials Class","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorialsclass.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/346276d8e1600eec36df1bf9adcf78bf1eabb87fc0a79250e0565a88809b8f14?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/346276d8e1600eec36df1bf9adcf78bf1eabb87fc0a79250e0565a88809b8f14?s=96&d=mm&r=g","caption":"Tutorials Class"},"sameAs":["tcadmin"]}]}},"_links":{"self":[{"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/posts\/4171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/comments?post=4171"}],"version-history":[{"count":2,"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/posts\/4171\/revisions"}],"predecessor-version":[{"id":6818,"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/posts\/4171\/revisions\/6818"}],"wp:attachment":[{"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/media?parent=4171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/categories?post=4171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/tags?post=4171"},{"taxonomy":"keywords","embeddable":true,"href":"https:\/\/tutorialsclass.com\/wp-json\/wp\/v2\/keywords?post=4171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}