{"id":16486,"date":"2025-10-02T09:00:38","date_gmt":"2025-10-02T09:00:38","guid":{"rendered":"https:\/\/www.kaashivinfotech.com\/blog\/?p=16486"},"modified":"2025-10-02T09:00:38","modified_gmt":"2025-10-02T09:00:38","slug":"what-is-set-in-python-examples","status":"publish","type":"post","link":"https:\/\/www.kaashivinfotech.com\/blog\/what-is-set-in-python-examples\/","title":{"rendered":"What is Set in Python? 7 Essential Insights That Boost Your Code"},"content":{"rendered":"<p><em>What is a set in Python?<\/em> If you\u2019ve ever had to clean messy data, remove duplicate records from a CSV file, or quickly check if a username already exists in your system, you\u2019ve already brushed against the idea of sets.<\/p>\n<p>Think of sets as Python\u2019s answer to <strong>real-world uniqueness<\/strong>. A passport number, a license plate, a roll number\u2014none of these can be duplicated. Sets bring that same principle into programming: no duplicates, no fuss.<\/p>\n<p>But they don\u2019t just stop at uniqueness. Sets are also <strong>fast<\/strong>. Really fast. A membership test in a set is, on average, <strong>up to 10x quicker<\/strong> than in a list, thanks to Python\u2019s hash table implementation. That performance boost can make a huge difference when you\u2019re working with <strong>millions of rows of data<\/strong>, like log files, user IDs, or large inventory lists.<\/p>\n<p>Developers often overlook sets because they seem \u201ctoo simple.\u201d But in practice, they\u2019re one of the most powerful tools for data cleaning, optimization, and even solving coding interview questions. Once you understand them, you\u2019ll wonder how you managed without them.<\/p>\n<hr \/>\n<h2>\ud83d\udd11 Key Highlights<\/h2>\n<ul>\n<li><strong>What is a set in Python?<\/strong> \u2192 A collection of unique, unordered, immutable elements.<\/li>\n<li><strong>Empty set in Python<\/strong> \u2192 Use <code class=\"\" data-line=\"\">set()<\/code>, <em>not<\/em> <code class=\"\" data-line=\"\">{}<\/code> (which creates a dictionary).<\/li>\n<li><strong>Mutable or immutable?<\/strong> \u2192 Sets are mutable; elements inside must be immutable.<\/li>\n<li><strong>Frozen set in Python<\/strong> \u2192 An immutable version of a set.<\/li>\n<li><strong>Real-world uses<\/strong> \u2192 Removing duplicate emails, filtering banned usernames, comparing datasets.<\/li>\n<li><strong>Performance boost<\/strong> \u2192 Set membership is much faster than list membership (O(1) vs O(n)).<\/li>\n<li><strong>Difference between list and set in Python<\/strong> \u2192 Lists allow duplicates and preserve order, sets don\u2019t.<\/li>\n<\/ul>\n<hr \/>\n<h2>What is Set in Python?<\/h2>\n<p>A <strong>set in Python<\/strong> is a built-in data type that stores a collection of <strong>unique elements<\/strong>. Unlike lists, sets automatically remove duplicates and don\u2019t maintain order. Unlike dictionaries, they don\u2019t store key-value pairs\u2014just the raw values themselves.<\/p>\n<p>\ud83d\udc49 Imagine a classroom roll call. The teacher only records each student\u2019s name once. No duplicates. That\u2019s exactly how sets behave in Python.<\/p>\n<p>Example:<\/p>\n<pre><code class=\"language-python\" data-line=\"\"># Creating a Python set\nfruits = {&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;, &quot;apple&quot;}\nprint(fruits)\n\n# Output:\n# {&#039;banana&#039;, &#039;cherry&#039;, &#039;apple&#039;}  # &quot;apple&quot; appears only once\n<\/code><\/pre>\n<p>This makes sets perfect for situations where <strong>uniqueness and speed matter<\/strong>.<\/p>\n<figure id=\"attachment_16504\" aria-describedby=\"caption-attachment-16504\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-medium wp-image-16504\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/What-is-Set-in-Python-300x167.webp\" alt=\"What is Set in Python\" width=\"300\" height=\"167\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/What-is-Set-in-Python-300x167.webp 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/What-is-Set-in-Python-768x427.webp 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/What-is-Set-in-Python-380x211.webp 380w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/What-is-Set-in-Python-800x444.webp 800w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/What-is-Set-in-Python.webp 900w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-16504\" class=\"wp-caption-text\">What is Set in Python<\/figcaption><\/figure>\n<hr \/>\n<h2>Characteristics of a Set in Python<\/h2>\n<p>Before diving into creating sets, it\u2019s important to understand their <strong>core characteristics<\/strong>. These little details often trip up beginners and can save you hours of debugging later.<\/p>\n<ol>\n<li><strong>Unordered<\/strong><br \/>\nSets don\u2019t preserve the order of elements. If you add items in one sequence, Python may store them in another.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">x = {&quot;a&quot;, &quot;b&quot;, &quot;c&quot;}\nprint(x)  \n# Output: {&#039;a&#039;, &#039;c&#039;, &#039;b&#039;}\n<\/code><\/pre>\n<p>\ud83d\udc49 So don\u2019t rely on index positions like you would in a list.<\/li>\n<li><strong>Unique Elements Only<\/strong><br \/>\nDuplicates vanish automatically. If you insert the same element multiple times, Python keeps just one.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">x = {&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;c&quot;}\nprint(x)  \n# Output: {&#039;a&#039;, &#039;b&#039;, &#039;c&#039;}\n<\/code><\/pre>\n<p>This makes sets excellent for <strong>data cleaning<\/strong>\u2014say you have a list of email addresses with duplicates, converting it into a set gives you a neat list of unique users instantly.<\/li>\n<li><strong>Immutable Elements<\/strong><br \/>\nEvery item in a set must be immutable (unchangeable). That means strings, numbers, and tuples are fine. Lists and dictionaries are not.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">s = {42, &quot;foo&quot;, (1, 2, 3)}   # \u2705 Works\ns = {[1, 2, 3], {&quot;a&quot;: 1}}    # \u274c TypeError\n<\/code><\/pre>\n<p>Why? Because sets use <strong>hashing<\/strong> under the hood. If an element changes, its hash changes, which would break the data structure.<\/li>\n<\/ol>\n<figure id=\"attachment_16507\" aria-describedby=\"caption-attachment-16507\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-medium wp-image-16507\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Characteristics-of-a-Set-in-Python-300x200.webp\" alt=\"Characteristics of a Set in Python\" width=\"300\" height=\"200\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Characteristics-of-a-Set-in-Python-300x200.webp 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Characteristics-of-a-Set-in-Python-1024x683.webp 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Characteristics-of-a-Set-in-Python-768x512.webp 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Characteristics-of-a-Set-in-Python-380x253.webp 380w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Characteristics-of-a-Set-in-Python-800x533.webp 800w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Characteristics-of-a-Set-in-Python-1160x773.webp 1160w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Characteristics-of-a-Set-in-Python.webp 1536w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-16507\" class=\"wp-caption-text\">Characteristics of a Set in Python<\/figcaption><\/figure>\n<hr \/>\n<h2>How to Create a Set in Python (Examples)<\/h2>\n<p>Python gives you <strong>two main ways<\/strong> to create sets:<\/p>\n<h3>1. Using Curly Braces <code class=\"\" data-line=\"\">{}<\/code><\/h3>\n<p>This is the most common method. Just wrap your items inside curly braces, separated by commas.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">languages = {&quot;Python&quot;, &quot;Java&quot;, &quot;C++&quot;}\nprint(type(languages))  \n# Output: &lt;class &#039;set&#039;&gt;\n<\/code><\/pre>\n<h3>2. Using the <code class=\"\" data-line=\"\">set()<\/code> Function<\/h3>\n<p>The <code class=\"\" data-line=\"\">set()<\/code> function accepts any iterable (list, tuple, string) and converts it into a set.<\/p>\n<pre><code class=\"language-python\" data-line=\"\"># From a list\nsample_set = set([&quot;100&quot;, &quot;Days&quot;, &quot;Of&quot;, &quot;Code&quot;])\nprint(sample_set)  \n# Output: {&#039;Days&#039;, &#039;100&#039;, &#039;Code&#039;, &#039;Of&#039;}\n\n# From a tuple\nt = (&quot;Tuple&quot;, &quot;as&quot;, &quot;an&quot;, &quot;iterable&quot;)\nprint(set(t))  \n# Output: {&#039;an&#039;, &#039;iterable&#039;, &#039;Tuple&#039;, &#039;as&#039;}\n\n# From a string\ns = &quot;Alpha&quot;\nprint(set(s))  \n# Output: {&#039;l&#039;, &#039;p&#039;, &#039;A&#039;, &#039;h&#039;, &#039;a&#039;}\n<\/code><\/pre>\n<h3>\u26a0\ufe0f Common Beginner Mistake<\/h3>\n<p>Defining an empty set using <code class=\"\" data-line=\"\">{}<\/code> doesn\u2019t work\u2014it creates a dictionary. Use <code class=\"\" data-line=\"\">set()<\/code> instead.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">s = set()\nprint(type(s))  \n# Output: &lt;class &#039;set&#039;&gt;\n<\/code><\/pre>\n<figure id=\"attachment_16508\" aria-describedby=\"caption-attachment-16508\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-medium wp-image-16508\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/How-to-Create-a-Set-in-Python-300x200.webp\" alt=\"How to Create a Set in Python\" width=\"300\" height=\"200\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/How-to-Create-a-Set-in-Python-300x200.webp 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/How-to-Create-a-Set-in-Python-1024x683.webp 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/How-to-Create-a-Set-in-Python-768x512.webp 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/How-to-Create-a-Set-in-Python-380x253.webp 380w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/How-to-Create-a-Set-in-Python-800x533.webp 800w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/How-to-Create-a-Set-in-Python-1160x773.webp 1160w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/How-to-Create-a-Set-in-Python.webp 1536w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-16508\" class=\"wp-caption-text\">How to Create a Set in Python<\/figcaption><\/figure>\n<hr \/>\n<h2>Is Set in Python Mutable or Immutable?<\/h2>\n<p>This is one of the <strong>most searched questions<\/strong> by beginners: <em>\u201cIs a set in Python mutable or immutable?\u201d<\/em><\/p>\n<p>The answer:<\/p>\n<ul>\n<li><strong>The set itself is mutable<\/strong> \u2192 you can add, remove, or update elements.<\/li>\n<li><strong>But the elements inside must be immutable<\/strong> \u2192 numbers, strings, tuples work fine; lists and dicts don\u2019t.<\/li>\n<\/ul>\n<p>Here\u2019s a quick demo:<\/p>\n<pre><code class=\"language-python\" data-line=\"\"># Mutable behavior (modifying the set)\ns = {&quot;Python&quot;, &quot;Java&quot;}\ns.add(&quot;C++&quot;)\nprint(s)  \n# Output: {&#039;Python&#039;, &#039;Java&#039;, &#039;C++&#039;}\n\n# Immutable elements only\ns = {&quot;Python&quot;, (1, 2, 3)}  # \u2705 Allowed\ns = {&quot;Python&quot;, [1, 2, 3]}  # \u274c TypeError\n<\/code><\/pre>\n<p>\ud83d\udc49 <strong>Pro tip for developers:<\/strong><br \/>\nWhen you need a set that <strong>can\u2019t be changed at all<\/strong>, use a <strong>frozen set<\/strong>. It\u2019s like a \u201cread-only\u201d version of a set, and it can even be used as a key in a dictionary because it\u2019s hashable.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">frozen = frozenset([&quot;A&quot;, &quot;B&quot;, &quot;C&quot;])\nprint(frozen)  \n# Output: frozenset({&#039;A&#039;, &#039;B&#039;, &#039;C&#039;})<\/code><\/pre>\n<hr \/>\n<h2>How to Create an Empty Set in Python<\/h2>\n<p>This one trips up beginners all the time. An <strong>empty set in Python<\/strong> looks deceptively similar to an empty dictionary.<\/p>\n<h3>Wrong Way \u274c<\/h3>\n<pre><code class=\"language-python\" data-line=\"\">s = {}\nprint(type(s))\n# Output: &lt;class &#039;dict&#039;&gt;\n<\/code><\/pre>\n<p>That\u2019s right \u2014 <code class=\"\" data-line=\"\">{}<\/code> creates a dictionary, not a set.<\/p>\n<h3>Right Way \u2705<\/h3>\n<pre><code class=\"language-python\" data-line=\"\">s = set()\nprint(type(s))\n# Output: &lt;class &#039;set&#039;&gt;\n<\/code><\/pre>\n<p>\ud83d\udc49 Best practice: Always use <code class=\"\" data-line=\"\">set()<\/code> when creating an empty set. This makes your code explicit, readable, and avoids confusion with dictionaries.<\/p>\n<p><strong>Real-world use case:<\/strong><br \/>\nImagine writing a script to keep track of unique visitors on a website. You\u2019d start with an empty set and keep adding visitor IDs:<\/p>\n<pre><code class=\"language-python\" data-line=\"\">unique_visitors = set()\nunique_visitors.add(&quot;user123&quot;)\nunique_visitors.add(&quot;user456&quot;)\nunique_visitors.add(&quot;user123&quot;)  # Duplicate, ignored\n\nprint(unique_visitors)\n# Output: {&#039;user456&#039;, &#039;user123&#039;}\n<\/code><\/pre>\n<p>That\u2019s why empty sets are a cornerstone when you\u2019re building collections dynamically.<\/p>\n<figure id=\"attachment_16509\" aria-describedby=\"caption-attachment-16509\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16509\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Empty-Set-in-Python-300x200.webp\" alt=\"Empty Set in Python\" width=\"300\" height=\"200\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Empty-Set-in-Python-300x200.webp 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Empty-Set-in-Python-1024x683.webp 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Empty-Set-in-Python-768x512.webp 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Empty-Set-in-Python-380x253.webp 380w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Empty-Set-in-Python-800x533.webp 800w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Empty-Set-in-Python-1160x773.webp 1160w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Empty-Set-in-Python.webp 1536w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-16509\" class=\"wp-caption-text\">Empty Set in Python<\/figcaption><\/figure>\n<hr \/>\n<h2>Frozen Set in Python<\/h2>\n<p>Sometimes, you need a set that <strong>no one can change<\/strong>. Enter the <strong>frozen set<\/strong>.<\/p>\n<ul>\n<li>A <strong>frozen set in Python<\/strong> is just like a normal set but <strong>immutable<\/strong>.<\/li>\n<li>Once created, you can\u2019t add or remove elements.<\/li>\n<li>Because it\u2019s immutable, a frozen set can even be used as a <strong>key in a dictionary<\/strong> (regular sets can\u2019t).<\/li>\n<\/ul>\n<pre><code class=\"language-python\" data-line=\"\"># Creating a frozen set\nfrozen = frozenset([&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;])\nprint(frozen)\n# Output: frozenset({&#039;apple&#039;, &#039;banana&#039;, &#039;cherry&#039;})\n\n# Trying to modify will fail\nfrozen.add(&quot;mango&quot;)  \n# AttributeError: &#039;frozenset&#039; object has no attribute &#039;add&#039;\n<\/code><\/pre>\n<p>\ud83d\udc49 <strong>Best practice:<\/strong> Use frozen sets when you want a constant set of values (like a fixed set of permissions, configuration states, or reserved keywords in a program).<\/p>\n<p><strong>Example from real projects:<\/strong><br \/>\nA developer might define a frozen set of supported file extensions:<\/p>\n<pre><code class=\"language-python\" data-line=\"\">ALLOWED_EXTENSIONS = frozenset({&quot;jpg&quot;, &quot;png&quot;, &quot;gif&quot;})\n<\/code><\/pre>\n<p>This prevents accidental changes during runtime.<\/p>\n<figure id=\"attachment_16512\" aria-describedby=\"caption-attachment-16512\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16512\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Frozen-Set-300x200.webp\" alt=\"Frozen Set in Python\" width=\"300\" height=\"200\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Frozen-Set-300x200.webp 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Frozen-Set-1024x683.webp 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Frozen-Set-768x512.webp 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Frozen-Set-380x253.webp 380w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Frozen-Set-800x533.webp 800w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Frozen-Set-1160x773.webp 1160w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Frozen-Set.webp 1536w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-16512\" class=\"wp-caption-text\">Frozen Set in Python<\/figcaption><\/figure>\n<hr \/>\n<h2>Real-World Use Cases of Sets in Python<\/h2>\n<p>Sets may look like a \u201ctextbook data type,\u201d but developers use them constantly in production code. Here\u2019s where they shine:<\/p>\n<ol>\n<li><strong>Removing Duplicates from a List<\/strong>\n<pre><code class=\"language-python\" data-line=\"\">emails = [&quot;a@gmail.com&quot;, &quot;b@gmail.com&quot;, &quot;a@gmail.com&quot;]\nunique_emails = list(set(emails))\nprint(unique_emails)\n# Output: [&#039;b@gmail.com&#039;, &#039;a@gmail.com&#039;]\n<\/code><\/pre>\n<p>\u2705 Handy in data cleaning, deduplication, and ETL processes.<\/li>\n<li><strong>Fast Membership Testing<\/strong>\n<pre><code class=\"language-python\" data-line=\"\">banned_users = {&quot;admin&quot;, &quot;root&quot;, &quot;superuser&quot;}\nif &quot;admin&quot; in banned_users:\n    print(&quot;Access Denied&quot;)\n<\/code><\/pre>\n<p>\u2705 Much faster than checking inside a list. Essential for login systems, spam filters, or security checks.<\/li>\n<li><strong>Finding Common Data (Intersection)<\/strong>\n<pre><code class=\"language-python\" data-line=\"\">course_A = {&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;}\ncourse_B = {&quot;Bob&quot;, &quot;David&quot;, &quot;Alice&quot;}\n\nprint(course_A &amp; course_B)\n# Output: {&#039;Alice&#039;, &#039;Bob&#039;}\n<\/code><\/pre>\n<p>\u2705 Useful in analytics \u2014 for example, finding students enrolled in both Python and Data Science courses.<\/li>\n<li><strong>Finding Differences (Set Difference)<\/strong>\n<pre><code class=\"language-python\" data-line=\"\">all_features = {&quot;login&quot;, &quot;search&quot;, &quot;payment&quot;, &quot;chat&quot;}\nbeta_features = {&quot;login&quot;, &quot;search&quot;}\n\nprint(all_features - beta_features)\n# Output: {&#039;payment&#039;, &#039;chat&#039;}\n<\/code><\/pre>\n<p>\u2705 Perfect for feature flagging in software releases.<\/li>\n<li><strong>Performance Edge in Big Data<\/strong><br \/>\nDid you know? In Python, checking if an item exists in a set (<code class=\"\" data-line=\"\">O(1)<\/code>) is up to <strong>10x faster<\/strong> than checking in a list (<code class=\"\" data-line=\"\">O(n)<\/code>). For datasets with millions of rows, sets can reduce query time from seconds to milliseconds.<\/li>\n<\/ol>\n<figure id=\"attachment_16513\" aria-describedby=\"caption-attachment-16513\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16513\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Use-Cases-of-Sets-in-Python-300x200.webp\" alt=\"Use Cases of Sets in Python\" width=\"300\" height=\"200\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Use-Cases-of-Sets-in-Python-300x200.webp 300w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Use-Cases-of-Sets-in-Python-1024x683.webp 1024w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Use-Cases-of-Sets-in-Python-768x512.webp 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Use-Cases-of-Sets-in-Python-380x253.webp 380w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Use-Cases-of-Sets-in-Python-800x533.webp 800w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Use-Cases-of-Sets-in-Python-1160x773.webp 1160w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Use-Cases-of-Sets-in-Python.webp 1536w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-16513\" class=\"wp-caption-text\">Use Cases of Sets in Python<\/figcaption><\/figure>\n<hr \/>\n<h2>Python Set Operations (With Examples)<\/h2>\n<p>One of the biggest strengths of sets in Python is how they make <strong>mathematical operations on collections<\/strong> simple and elegant. Think about comparing datasets, finding overlaps, or filtering unique values\u2014you\u2019ll end up using these operations all the time.<\/p>\n<p>Here are the most common ones every developer should know:<\/p>\n<h3>1. Union ( <code class=\"\" data-line=\"\">|<\/code> or <code class=\"\" data-line=\"\">.union()<\/code> )<\/h3>\n<p>Combines elements from two sets, removing duplicates.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">frontend = {&quot;HTML&quot;, &quot;CSS&quot;, &quot;JavaScript&quot;}\nbackend = {&quot;Python&quot;, &quot;JavaScript&quot;, &quot;SQL&quot;}\n\nprint(frontend | backend)  \n# Output: {&#039;HTML&#039;, &#039;CSS&#039;, &#039;JavaScript&#039;, &#039;Python&#039;, &#039;SQL&#039;}\n<\/code><\/pre>\n<p>\ud83d\udc49 Use case: merging user roles or feature sets without duplicates.<\/p>\n<h3>2. Intersection ( <code class=\"\" data-line=\"\">&amp;<\/code> or <code class=\"\" data-line=\"\">.intersection()<\/code> )<\/h3>\n<p>Finds elements common to both sets.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">students_A = {&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;}\nstudents_B = {&quot;Bob&quot;, &quot;David&quot;, &quot;Alice&quot;}\n\nprint(students_A &amp; students_B)  \n# Output: {&#039;Alice&#039;, &#039;Bob&#039;}\n<\/code><\/pre>\n<p>\ud83d\udc49 Use case: identifying overlapping users, customers subscribed to multiple services, or shared tags in datasets.<\/p>\n<h3>3. Difference ( <code class=\"\" data-line=\"\">-<\/code> or <code class=\"\" data-line=\"\">.difference()<\/code> )<\/h3>\n<p>Finds elements present in one set but not the other.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">all_features = {&quot;login&quot;, &quot;search&quot;, &quot;payment&quot;, &quot;chat&quot;}\nbeta_features = {&quot;login&quot;, &quot;search&quot;}\n\nprint(all_features - beta_features)  \n# Output: {&#039;payment&#039;, &#039;chat&#039;}\n<\/code><\/pre>\n<p>\ud83d\udc49 Use case: feature flagging\u2014knowing which features are not yet released.<\/p>\n<h3>4. Symmetric Difference ( <code class=\"\" data-line=\"\">^<\/code> or <code class=\"\" data-line=\"\">.symmetric_difference()<\/code> )<\/h3>\n<p>Finds elements in either set, but not both.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">team_A = {&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;}\nteam_B = {&quot;Bob&quot;, &quot;David&quot;}\n\nprint(team_A ^ team_B)  \n# Output: {&#039;Alice&#039;, &#039;Charlie&#039;, &#039;David&#039;}\n<\/code><\/pre>\n<p>\ud83d\udc49 Use case: detecting mismatched entries or identifying records exclusive to one dataset.<\/p>\n<p>\u26a1 <strong>Pro tip for interviews:<\/strong> Questions about \u201ccommon elements between two lists\u201d or \u201cfind unique values\u201d can almost always be solved using set operations\u2014much faster than nested loops.<\/p>\n<hr \/>\n<h2>Difference Between List and Set in Python<\/h2>\n<p>This is a question that pops up in both coding interviews and real projects. Lists and sets may seem similar, but their <strong>performance and behavior<\/strong> are quite different.<\/p>\n<table>\n<thead>\n<tr>\n<th>Feature<\/th>\n<th>List<\/th>\n<th>Set<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>Duplicates<\/strong><\/td>\n<td>Allowed<\/td>\n<td>Not allowed (auto-removed)<\/td>\n<\/tr>\n<tr>\n<td><strong>Order<\/strong><\/td>\n<td>Preserves insertion order<\/td>\n<td>Unordered (no index access)<\/td>\n<\/tr>\n<tr>\n<td><strong>Mutability<\/strong><\/td>\n<td>Mutable<\/td>\n<td>Mutable (elements immutable)<\/td>\n<\/tr>\n<tr>\n<td><strong>Membership Test<\/strong><\/td>\n<td>Slower (O(n))<\/td>\n<td>Faster (O(1) average)<\/td>\n<\/tr>\n<tr>\n<td><strong>Use Case<\/strong><\/td>\n<td>Ordered data, sequential ops<\/td>\n<td>Unique data, fast lookups<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>When to use a list:<\/strong><\/p>\n<ul>\n<li>When order matters (like a playlist or ordered tasks).<\/li>\n<li>When duplicates are acceptable.<\/li>\n<\/ul>\n<p><strong>When to use a set:<\/strong><\/p>\n<ul>\n<li>When uniqueness is required (like IDs, emails, usernames).<\/li>\n<li>When speed of membership testing matters (like checking banned IPs in security logs).<\/li>\n<\/ul>\n<p>\ud83d\udc49 Real-world insight: At scale, switching from lists to sets for membership checks can cut processing time dramatically. For example, filtering <strong>1M log entries<\/strong> against a blacklist in a set runs in milliseconds, while doing it with a list can take seconds.<\/p>\n<hr \/>\n<h2>How to Convert List to Set in Python<\/h2>\n<p>Another very common task: you\u2019ve got a list with duplicates and you want only unique values. That\u2019s where converting a <strong>list to a set<\/strong> comes in.<\/p>\n<h3>Example:<\/h3>\n<pre><code class=\"language-python\" data-line=\"\">emails = [&quot;a@gmail.com&quot;, &quot;b@gmail.com&quot;, &quot;a@gmail.com&quot;, &quot;c@gmail.com&quot;]\nunique_emails = set(emails)\n\nprint(unique_emails)\n# Output: {&#039;b@gmail.com&#039;, &#039;c@gmail.com&#039;, &#039;a@gmail.com&#039;}\n<\/code><\/pre>\n<p>Notice how the duplicate <code class=\"\" data-line=\"\">&quot;a@gmail.com&quot;<\/code> disappeared.<\/p>\n<h3>Best Practice \ud83d\udca1<\/h3>\n<ul>\n<li>Use this trick in <strong>data cleaning<\/strong> pipelines to eliminate duplicate rows quickly.<\/li>\n<li>After conversion, if you need the result back in list form (for indexing or preserving type), just wrap it back:<\/li>\n<\/ul>\n<pre><code class=\"language-python\" data-line=\"\">emails = list(set(emails))\n<\/code><\/pre>\n<p>\ud83d\udc49 <strong>Pro tip for devs:<\/strong> This is the fastest way to deduplicate lists in Python. According to Python community benchmarks, using <code class=\"\" data-line=\"\">set()<\/code> for deduplication is significantly faster than manual loops or list comprehensions.<\/p>\n<hr \/>\n<h2>Set Membership in Python (Fast Lookups)<\/h2>\n<p>One of the reasons developers love sets is <strong>speed<\/strong>. Checking whether an element exists in a set is, on average, <strong>O(1)<\/strong> \u2014 constant time. That\u2019s a fancy way of saying it\u2019s blazing fast compared to lists, which take <strong>O(n)<\/strong> time (linear search).<\/p>\n<h3>Example:<\/h3>\n<pre><code class=\"language-python\" data-line=\"\">users = {&quot;alice&quot;, &quot;bob&quot;, &quot;charlie&quot;, &quot;david&quot;}\n\nprint(&quot;alice&quot; in users)   # True\nprint(&quot;eve&quot; in users)     # False\n<\/code><\/pre>\n<p>\ud83d\udc49 With a list, Python would check each element one by one until it finds (or doesn\u2019t find) a match. With a set, it uses <strong>hashing<\/strong> to jump directly to the element\u2019s memory location.<\/p>\n<p><strong>Real-world use cases of membership testing with sets:<\/strong><\/p>\n<ul>\n<li><strong>Authentication systems<\/strong> \u2192 Quickly verify if a username exists in a large database.<\/li>\n<li><strong>Spam filtering<\/strong> \u2192 Instantly check if an email address belongs to a blocklist.<\/li>\n<li><strong>Inventory systems<\/strong> \u2192 Confirm if a product code is valid without scanning the entire catalog.<\/li>\n<\/ul>\n<p>\u26a1 <strong>Pro tip:<\/strong> When handling <strong>millions of lookups<\/strong> (like real-time fraud detection or IP blocking), switching from lists to sets can save <strong>seconds or even minutes<\/strong> of processing time.<\/p>\n<hr \/>\n<h2>Determining the Size of\u00a0 Set in Python<\/h2>\n<p>Sometimes you just need to know: <em>How many unique items do I have?<\/em><\/p>\n<p>Python makes this easy with the built-in <code class=\"\" data-line=\"\">len()<\/code> function.<\/p>\n<pre><code class=\"language-python\" data-line=\"\">products = {&quot;Laptop&quot;, &quot;Phone&quot;, &quot;Tablet&quot;, &quot;Phone&quot;}\nprint(len(products))  \n\n# Output: 3\n<\/code><\/pre>\n<p>\ud83d\udc49 Notice how <code class=\"\" data-line=\"\">&quot;Phone&quot;<\/code> was added twice but only counted once.<\/p>\n<p><strong>Why this matters in real projects:<\/strong><\/p>\n<ul>\n<li><strong>Data analytics<\/strong> \u2192 Quickly measure unique visitors on a website.<\/li>\n<li><strong>E-commerce<\/strong> \u2192 Count distinct products sold in a given month.<\/li>\n<li><strong>Log analysis<\/strong> \u2192 Find unique IPs hitting a server.<\/li>\n<\/ul>\n<p>\ud83d\udca1 <strong>Best practice:<\/strong> Use <code class=\"\" data-line=\"\">len(set(data))<\/code> when you need to count unique values in a dataset. It\u2019s often faster and cleaner than looping with conditionals.<\/p>\n<hr \/>\n<h2>Python Set Methods You Should Know \ud83d\ude80<\/h2>\n<p>Once you\u2019ve created a set, you\u2019ll want to do more than just stare at it. Python ships with a rich collection of <strong>set methods<\/strong> that let you manipulate data like a pro.<\/p>\n<p>Here are some of the most useful:<\/p>\n<ul>\n<li><strong><code class=\"\" data-line=\"\">add()<\/code><\/strong> \u2192 Add a single element.<\/li>\n<li><strong><code class=\"\" data-line=\"\">update()<\/code><\/strong> \u2192 Add multiple elements from another iterable.<\/li>\n<li><strong><code class=\"\" data-line=\"\">remove()<\/code> \/ <code class=\"\" data-line=\"\">discard()<\/code><\/strong> \u2192 Remove elements (the difference is <code class=\"\" data-line=\"\">discard<\/code> won\u2019t throw an error if the element doesn\u2019t exist).<\/li>\n<li><strong><code class=\"\" data-line=\"\">pop()<\/code><\/strong> \u2192 Remove and return a random element.<\/li>\n<li><strong><code class=\"\" data-line=\"\">clear()<\/code><\/strong> \u2192 Empty the set.<\/li>\n<li><strong><code class=\"\" data-line=\"\">union()<\/code><\/strong> \u2192 Combine two sets (like merging user lists from two apps).<\/li>\n<li><strong><code class=\"\" data-line=\"\">intersection()<\/code><\/strong> \u2192 Find common elements (e.g., users who subscribed to both newsletters).<\/li>\n<li><strong><code class=\"\" data-line=\"\">difference()<\/code><\/strong> \u2192 Get elements in one set but not the other (e.g., products in inventory but not in sales).<\/li>\n<li><strong><code class=\"\" data-line=\"\">symmetric_difference()<\/code><\/strong> \u2192 Get elements that are unique to each set.<\/li>\n<\/ul>\n<p>\ud83d\udc49 Best practice? Use these methods instead of loops wherever possible. They\u2019re optimized in C under the hood, making them <strong>faster and cleaner<\/strong> than writing your own iteration logic.<\/p>\n<figure id=\"attachment_16515\" aria-describedby=\"caption-attachment-16515\" style=\"width: 210px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16515\" src=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-210x300.webp\" alt=\"Python Set Methods Cheet sheet\" width=\"210\" height=\"300\" srcset=\"https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-210x300.webp 210w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-715x1024.webp 715w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-768x1099.webp 768w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-1073x1536.webp 1073w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-1431x2048.webp 1431w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-380x544.webp 380w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-800x1145.webp 800w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-1160x1661.webp 1160w, https:\/\/www.kaashivinfotech.com\/blog\/wp-content\/uploads\/2025\/10\/Python-Set-Methods-Cheet-sheet-scaled.webp 1788w\" sizes=\"(max-width: 210px) 100vw, 210px\" \/><figcaption id=\"caption-attachment-16515\" class=\"wp-caption-text\">Python Set Methods Cheet sheet<\/figcaption><\/figure>\n<hr \/>\n<h2>Are Sets Ordered or Unordered in Python? (And Why It Matters)<\/h2>\n<p>This question pops up in almost every Python interview: <em>Are sets ordered or unordered?<\/em><\/p>\n<ul>\n<li>In <strong>Python 3.6 and below<\/strong>, sets are completely <strong>unordered<\/strong>.<\/li>\n<li>From <strong>Python 3.7+<\/strong>, sets <em>maintain insertion order<\/em> <strong>as an implementation detail<\/strong>.<\/li>\n<li>But here\u2019s the catch: <strong>you shouldn\u2019t rely on that order<\/strong> because it\u2019s not guaranteed by the language specification.<\/li>\n<\/ul>\n<p>\ud83d\udc49 Translation for developers: If order matters, use a <strong>list<\/strong> or <strong><code class=\"\" data-line=\"\">collections.OrderedDict<\/code><\/strong> (or in Python 3.7+, a regular dict). If uniqueness matters, use a <strong>set<\/strong>.<\/p>\n<p><strong>Example (Python 3.10+):<\/strong><\/p>\n<pre><code class=\"language-python\" data-line=\"\">numbers = {10, 20, 30, 40}\nprint(numbers)  # Maintains insertion order in most modern versions\n<\/code><\/pre>\n<p>But tomorrow, Python may optimize it differently. That\u2019s why in <strong>real-world projects<\/strong> (like APIs or database sync jobs), relying on order in sets is a risky move.<\/p>\n<hr \/>\n<h2>The Algorithm Behind Sets &amp; Why It\u2019s Career-Relevant \u26a1<\/h2>\n<p>Here\u2019s where most tutorials stop\u2014but let\u2019s go deeper.<\/p>\n<p>Python sets are implemented using <strong>hash tables<\/strong>. Each element\u2019s hash value determines where it gets stored in memory. That\u2019s why:<\/p>\n<ul>\n<li><strong>Adding an element<\/strong> \u2192 O(1) average time.<\/li>\n<li><strong>Checking membership (<code class=\"\" data-line=\"\">in<\/code>)<\/strong> \u2192 O(1) average time.<\/li>\n<li><strong>Removing an element<\/strong> \u2192 O(1) average time.<\/li>\n<li><strong>Iterating through a set<\/strong> \u2192 O(n), since every element needs to be touched.<\/li>\n<\/ul>\n<p>\ud83d\udc49 Compare this to lists: membership checks (<code class=\"\" data-line=\"\">x in list<\/code>) take O(n), which makes sets a much smarter choice for <strong>big data lookups<\/strong>.<\/p>\n<h3>Real-world analogy:<\/h3>\n<p>Imagine you\u2019re a security engineer managing a <strong>blocklist of 10 million IPs<\/strong>. Using a list, every login attempt could take seconds to verify. Using a set, it\u2019s instant. That\u2019s the power of hashing.<\/p>\n<hr \/>\n<h3>How This Translates to Your Career \ud83d\ude80<\/h3>\n<ul>\n<li><strong>Interviews<\/strong>: Set operations are favorite topics in coding interviews. Questions like <em>\u201cFind the intersection of two lists\u201d<\/em> or <em>\u201cDetect duplicates in an array\u201d<\/em> are best solved with sets.<\/li>\n<li><strong>Data Science<\/strong>: Cleaning large datasets (removing duplicates, filtering unique values) is 10x faster with sets.<\/li>\n<li><strong>Backend Engineering<\/strong>: Fast membership checks are critical for APIs, authentication systems, and caching.<\/li>\n<li><strong>Cybersecurity<\/strong>: Blocklists, spam filters, fraud detection \u2014 all rely heavily on set-like data structures.<\/li>\n<\/ul>\n<p>\ud83d\udca1 <strong>Pro tip:<\/strong> If you can explain <em>why<\/em> sets use hashing and <em>how<\/em> that impacts performance, you stand out in interviews\u2014not just as someone who codes, but as someone who understands the deeper <strong>computer science trade-offs<\/strong>.<\/p>\n<hr \/>\n<h2>Wrapping Up: Why Python Set Should Be in Your Toolbox<\/h2>\n<p>So, what is a set in Python? More than just a \u201cunique collection.\u201d It\u2019s a <strong>performance booster<\/strong>, a <strong>data cleaner<\/strong>, and a <strong>problem solver<\/strong> every developer should master.<\/p>\n<ul>\n<li>They give you <strong>uniqueness<\/strong> without extra effort.<\/li>\n<li>They let you run <strong>fast membership checks<\/strong>.<\/li>\n<li>They support <strong>powerful operations<\/strong> like union, intersection, and difference with just one line of code.<\/li>\n<li>They make your <strong>data pipelines cleaner and faster<\/strong>.<\/li>\n<\/ul>\n<p>\ud83d\udc49 Next time you\u2019re handling duplicate user IDs, filtering spam emails, or trying to optimize your code for performance, remember: a Python set is often the simplest\u2014and smartest\u2014answer.<\/p>\n<hr \/>\n<h2>\ud83d\udcda Related Reads<\/h2>\n<ul>\n<li><strong><a href=\"https:\/\/www.wikitechy.com\/polymorphism-in-oops-guide-2025\/\" target=\"_blank\" rel=\"noopener\">Polymorphism in OOPs \u2013 The Complete Guide with Examples<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/www.kaashivinfotech.com\/blog\/oops-principles-in-java\/\">OOPS Principles in Java \u2013 Master Java Object Oriented Programming Concepts<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/www.kaashivinfotech.com\/blog\/decorators-in-python-6-lessons\/\">Decorators in Python: 6 Lessons I Learned the Hard Way<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/www.kaashivinfotech.com\/blog\/what-is-python-interpreter-guide\/\">What is Python Interpreter? Complete Beginner-Friendly Guide 2025<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/www.kaashivinfotech.com\/blog\/switch-case-guide-2025\/\">Switch Case Explained: C, Java, Python &amp; JavaScript (Complete 2025 Guide)<\/a><\/strong><\/li>\n<li><strong><a href=\"https:\/\/www.kaashivinfotech.com\/blog\/how-to-use-timedelta-in-python\/\">How to Use Timedelta in Python to Add and Subtract Dates (2025 Guide)<\/a><\/strong><\/li>\n<\/ul>\n<hr \/>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is a set in Python? If you\u2019ve ever had to clean messy data, remove duplicate records from a CSV file, or quickly check if a username already exists in your system, you\u2019ve already brushed against the idea of sets. Think of sets as Python\u2019s answer to real-world uniqueness. A passport number, a license plate, [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":16516,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3203,3236],"tags":[9539,9537,9538,9544,9542,9532,9543,9533,9540,9534,9535,9541,9536,9531],"class_list":["post-16486","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","category-python","tag-difference-between-list-and-set-in-python","tag-empty-set-in-python","tag-frozen-set-in-python","tag-how-to-convert-list-to-set-in-python","tag-ordered-set-in-python","tag-python-set","tag-python-set-career-use-cases","tag-python-set-example","tag-python-set-membership","tag-python-set-methods","tag-python-set-operations","tag-python-set-time-complexity","tag-set-in-python-is-mutable-or-immutable","tag-what-is-set-in-python"],"_links":{"self":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/16486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/comments?post=16486"}],"version-history":[{"count":0,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/16486\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/media\/16516"}],"wp:attachment":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/media?parent=16486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/categories?post=16486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/tags?post=16486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}