{"id":399,"date":"2024-03-05T23:43:49","date_gmt":"2024-03-05T18:13:49","guid":{"rendered":"https:\/\/mrcoder701.com\/?p=399"},"modified":"2024-03-05T23:50:58","modified_gmt":"2024-03-05T18:20:58","slug":"differences-between-list-tuple-set-and-dictionary-in-python","status":"publish","type":"post","link":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/","title":{"rendered":"Differences Between List, Tuple, Set and Dictionary in Python"},"content":{"rendered":"

Introduction to Python Data Structures<\/strong><\/h2>

Python, the ever-popular programming language, is beloved for its simplicity and readability, making it a go-to for beginners and seasoned developers alike. At the heart of Python’s simplicity lies its core data structures: lists, tuples, sets, and dictionaries. Each serves a unique purpose, and understanding their differences is crucial for any aspiring Pythonista. So, buckle up as we delve into the nuances of these structures, complete with examples to illuminate your path through Python’s data jungle.<\/p>

Key Difference Between List, Tuple, Set, and Dictionary in Python
<\/h2>

Mutability:<\/strong><\/p>

  • List:<\/strong> Mutable (modifiable).<\/li>\n\n
  • Tuple:<\/strong> Immutable (non-modifiable).<\/li>\n\n
  • Set:<\/strong> Mutable, but elements must be immutable.<\/li>\n\n
  • Dictionary:<\/strong> Mutable; keys are immutable, but values can change.<\/li><\/ul>

    Order:<\/strong><\/p>

    • List:<\/strong> Maintains order of elements.<\/li>\n\n
    • Tuple:<\/strong> Maintains order of elements.<\/li>\n\n
    • Set:<\/strong> No guaranteed order.<\/li>\n\n
    • Dictionary:<\/strong> As of Python 3.7+, insertion order is preserved.<\/li><\/ul>

      Uniqueness:<\/strong><\/p>

      • List:<\/strong> Allows duplicates.<\/li>\n\n
      • Tuple:<\/strong> Allows duplicates.<\/li>\n\n
      • Set:<\/strong> Only unique elements.<\/li>\n\n
      • Dictionary:<\/strong> Unique keys, values can be duplicated.<\/li><\/ul>

        Data Structure:<\/strong><\/p>

        • List:<\/strong> Ordered collection.<\/li>\n\n
        • Tuple:<\/strong> Ordered collection.<\/li>\n\n
        • Set:<\/strong> Unordered collection.<\/li>\n\n
        • Dictionary:<\/strong> Collection of key-value pairs<\/li><\/ul>
          \n <\/path>\n<\/svg><\/div><\/div>

          Let us know more about Lists, Tuples, Sets and Dictionaries in following topics:<\/strong><\/p>

          List: The Versatile Collection<\/strong><\/p>

          • Definition<\/strong>: Lists are ordered collections of items that can be of different types. They are mutable, meaning their elements can be changed after the list is created.<\/li>\n\n
          • Syntax<\/strong>: Created with square brackets []<\/code>.<\/li>\n\n
          • Features<\/strong>:
            • Index-based: You can access elements by their position in the list.<\/li>\n\n
            • Allows duplicate elements.<\/li>\n\n
            • Elements can be added, removed, or changed.<\/li><\/ul><\/li>\n\n
            • Use Cases<\/strong>: When you need an ordered collection of items that may need to be modified, or when you want to store a sequence of items.<\/li><\/ul>

              Syntax & Examples:<\/strong><\/p>

              <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
              list1<\/span> <\/span>=<\/span> [<\/span>3<\/span> <\/span>,<\/span> <\/span>4<\/span>,<\/span> <\/span>'<\/span>ABC<\/span>'<\/span>,<\/span> <\/span>3<\/span>,<\/span> <\/span>'<\/span>list<\/span>'<\/span>]<\/span><\/span>\nlist2<\/span> <\/span>=<\/span> []<\/span><\/span>\nlist3<\/span> <\/span>=<\/span> <\/span>list<\/span>((<\/span>4<\/span>,<\/span> <\/span>2<\/span>,<\/span> <\/span>8<\/span>))<\/span><\/span>\nprint<\/span>(<\/span>list1<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>list2<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>list3<\/span>)<\/span><\/span>\n<\/span>\n#OUTPUT<\/span>:<\/span><\/span>\n[<\/span>3<\/span>,<\/span> <\/span>4<\/span>,<\/span> <\/span>'<\/span>ABC<\/span>'<\/span>,<\/span> <\/span>3<\/span>,<\/span> <\/span>'<\/span>list<\/span>'<\/span>]<\/span><\/span>\n[]<\/span><\/span>\n[<\/span>4<\/span>,<\/span> <\/span>2<\/span>,<\/span> <\/span>8<\/span>]<\/span><\/span><\/code><\/pre><\/div>

              Indexing<\/strong><\/p>

              <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
              list1<\/span> <\/span>=<\/span> [<\/span>1<\/span>,<\/span> <\/span>2<\/span>,<\/span> <\/span>"<\/span>mrcoder<\/span>"<\/span>,<\/span> <\/span>3<\/span>]<\/span><\/span>\nprint<\/span>(<\/span>list1<\/span>[<\/span>2<\/span>])<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\nmrcoder<\/span><\/span><\/code><\/pre><\/div>

              Adding New Element<\/strong><\/p>

              <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
              list1<\/span> <\/span>=<\/span> [<\/span>"<\/span>1<\/span>"<\/span>,<\/span> <\/span>"<\/span>2<\/span>"<\/span>,<\/span> <\/span>"<\/span>3<\/span>"<\/span>]<\/span><\/span>\nlist1<\/span>.<\/span>append<\/span>(<\/span>"<\/span>4<\/span>"<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>list1<\/span>)<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n[<\/span>'<\/span>1<\/span>'<\/span>,<\/span> <\/span>'<\/span>2<\/span>'<\/span>,<\/span> <\/span>'<\/span>3<\/span>'<\/span>,<\/span> <\/span>'<\/span>4<\/span>'<\/span>]<\/span><\/span><\/code><\/pre><\/div>

              Deleting Element<\/strong><\/p>

              <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
              list1<\/span> <\/span>=<\/span> [<\/span>"<\/span>1<\/span>"<\/span>,<\/span> <\/span>"<\/span>2<\/span>"<\/span>,<\/span> <\/span>"<\/span>3<\/span>"<\/span>,<\/span> <\/span>"<\/span>4<\/span>"<\/span>]<\/span><\/span>\nlist1<\/span>.<\/span>pop<\/span>()<\/span><\/span>\nprint<\/span>(<\/span>list1<\/span>)<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n[<\/span>'<\/span>1<\/span>'<\/span>,<\/span> <\/span>'<\/span>2<\/span>'<\/span>,<\/span> <\/span>'<\/span>3<\/span>'<\/span>]<\/span><\/span><\/code><\/pre><\/div>

              Sorting Elements<\/strong><\/p>

              <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
              list1<\/span> <\/span>=<\/span> [<\/span>6<\/span>,<\/span> <\/span>34<\/span>,<\/span> <\/span>24<\/span>,<\/span> <\/span>1<\/span>,<\/span> <\/span>234<\/span>]<\/span><\/span>\nlist1<\/span>.<\/span>sort<\/span>()<\/span><\/span>\nprint<\/span>(<\/span>list1<\/span>)<\/span><\/span>\n<\/span>\n#<\/span>output<\/span><\/span>\n[<\/span>1<\/span>,<\/span> <\/span>6<\/span>,<\/span> <\/span>24<\/span>,<\/span> <\/span>34<\/span>,<\/span> <\/span>234<\/span>]<\/span><\/span><\/code><\/pre><\/div>

              Searching Elements<\/strong><\/p>

              <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
              list1<\/span> <\/span>=<\/span> [<\/span>34<\/span>,<\/span> <\/span>323<\/span>,<\/span> <\/span>74<\/span>,<\/span> <\/span>132<\/span>,<\/span> <\/span>11<\/span>]<\/span><\/span>\n# <\/span>index<\/span>() <\/span>returns<\/span> <\/span>index<\/span> <\/span>for<\/span> <\/span>4<\/span> <\/span>in<\/span> <\/span>list1<\/span><\/span>\nprint<\/span>(<\/span>list1<\/span>.<\/span>index<\/span>(<\/span>11<\/span>))<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n4<\/span><\/span><\/code><\/pre><\/div>

              Reversing Elements<\/strong><\/p>

              <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
              list1<\/span> <\/span>=<\/span> [<\/span>34<\/span>,<\/span> <\/span>323<\/span>,<\/span> <\/span>74<\/span>,<\/span> <\/span>132<\/span>,<\/span> <\/span>11<\/span>]<\/span><\/span>\nlist1<\/span>.<\/span>reverse<\/span>()<\/span><\/span>\nprint<\/span>(<\/span>list1<\/span>)<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n[<\/span>11<\/span>,<\/span> <\/span>132<\/span>,<\/span> <\/span>74<\/span>,<\/span> <\/span>323<\/span>,<\/span> <\/span>34<\/span>]<\/span><\/span><\/code><\/pre><\/div>

              Counting Elements<\/strong><\/p>

              <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
              list1<\/span> <\/span>=<\/span> [<\/span>1<\/span>,<\/span> <\/span>6<\/span>,<\/span> <\/span>3<\/span>,<\/span> <\/span>6<\/span>,<\/span> <\/span>8<\/span>,<\/span> <\/span>1<\/span>,<\/span> <\/span>5<\/span>]<\/span><\/span>\nprint<\/span>(<\/span>list1<\/span>.<\/span>count<\/span>(<\/span>6<\/span>))<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n2<\/span><\/span><\/code><\/pre><\/div>
              \n <\/path>\n<\/svg><\/div><\/div>

              Tuple: The Immutable Collection<\/strong><\/p>

              • Definition<\/strong>: Tuples are similar to lists but are immutable, meaning once a tuple is created, its elements cannot be changed.<\/li>\n\n
              • Syntax<\/strong>: Created with parentheses ()<\/code>.<\/li>\n\n
              • Features<\/strong>:
                • Index-based.<\/li>\n\n
                • Allows duplicate elements.<\/li>\n\n
                • Cannot be modified after creation (immutable).<\/li><\/ul><\/li>\n\n
                • Use Cases<\/strong>: When you need an ordered collection of items that should not change through the course of the program. Ideal for storing fixed data.<\/li><\/ul>

                  Syntax & Examples:<\/strong><\/p>

                  <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
                  tuple1<\/span> <\/span>=<\/span> (<\/span>1<\/span>,<\/span> <\/span>2<\/span>,<\/span> <\/span>'<\/span>abc<\/span>'<\/span>,<\/span> <\/span>3<\/span>,<\/span> <\/span>'<\/span>def<\/span>'<\/span>)<\/span><\/span>\ntuple2<\/span> <\/span>=<\/span> ()<\/span><\/span>\ntuple3<\/span> <\/span>=<\/span> <\/span>tuple<\/span>((<\/span>1<\/span>,<\/span> <\/span>2<\/span>,<\/span> <\/span>3<\/span>))<\/span><\/span>\nprint<\/span>(<\/span>tuple1<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>tuple2<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>tuple3<\/span>)<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n(<\/span>1<\/span>,<\/span> <\/span>2<\/span>,<\/span> <\/span>'<\/span>abc<\/span>'<\/span>,<\/span> <\/span>3<\/span>,<\/span> <\/span>'<\/span>def<\/span>'<\/span>)<\/span><\/span>\n()<\/span><\/span>\n(<\/span>1<\/span>,<\/span> <\/span>2<\/span>,<\/span> <\/span>3<\/span>)<\/span><\/span><\/code><\/pre><\/div>

                  Indexing<\/strong><\/p>

                  <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
                  tuple1<\/span> <\/span>=<\/span> (<\/span>6<\/span>,<\/span> <\/span>2<\/span>,<\/span> <\/span>"<\/span>mrcoder<\/span>"<\/span>,<\/span> <\/span>7<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>tuple1<\/span>[<\/span>2<\/span>])<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\nmrcoder<\/span><\/span><\/code><\/pre><\/div>
                  \n <\/path>\n<\/svg><\/div><\/div>

                  Set: The Unique Element Collector<\/strong><\/p>

                  • Definition<\/strong>: Sets are unordered collections of unique elements. They are mutable and do not allow duplicate elements.<\/li>\n\n
                  • Syntax<\/strong>: Created with curly braces {}<\/code> or the set()<\/code> function for an empty set.<\/li>\n\n
                  • Features<\/strong>:
                    • Unordered, so elements cannot be accessed by index.<\/li>\n\n
                    • Automatically remove duplicate elements.<\/li>\n\n
                    • Elements can be added or removed.<\/li><\/ul><\/li>\n\n
                    • Use Cases<\/strong>: When you need to ensure all elements are unique or when you need to perform set operations like union, intersection, difference, etc.<\/li><\/ul>

                      Syntax & Examples:<\/strong><\/p>

                      <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
                      thisset<\/span> <\/span>=<\/span> <\/span>{<\/span>"<\/span>apple<\/span>"<\/span>,<\/span> <\/span>"<\/span>banana<\/span>"<\/span>,<\/span> <\/span>"<\/span>cherry<\/span>"<\/span>}<\/span><\/span>\nprint<\/span>(<\/span>thisset<\/span>)<\/span><\/span>\n<\/span>\n# Note<\/span>:<\/span> <\/span>the<\/span> <\/span>set<\/span> <\/span>list<\/span> <\/span>is<\/span> <\/span>unordered<\/span>,<\/span> meaning<\/span>:<\/span> <\/span>the<\/span> <\/span>items<\/span> <\/span>will<\/span> <\/span>appear<\/span> <\/span>in<\/span> <\/span>a<\/span> <\/span>random<\/span> <\/span>order<\/span>.<\/span><\/span>\n#<\/span>OUTPUT<\/span><\/span>\n{<\/span>'<\/span>banana<\/span>'<\/span>,<\/span> <\/span>'<\/span>apple<\/span>'<\/span>,<\/span> <\/span>'<\/span>cherry<\/span>'<\/span>}<\/span><\/span>\n<\/span><\/code><\/pre><\/div>
                      \n <\/path>\n<\/svg><\/div><\/div>

                      Dictionary: Key-Value Pairing<\/strong><\/p>

                      • Definition<\/strong>: Dictionaries are unordered collections of key-value pairs. Keys must be unique and immutable, but values can be of any type and mutable.<\/li>\n\n
                      • Syntax<\/strong>: Created with curly braces {}<\/code> with key-value pairs separated by colons :<\/code>.<\/li>\n\n
                      • Features<\/strong>:
                        • Key-value pairs allow direct access to values by keys.<\/li>\n\n
                        • Keys must be unique and immutable (e.g., strings, numbers, or tuples).<\/li>\n\n
                        • Values can be of any type and can be changed.<\/li>\n\n
                        • Elements can be added, removed, or changed.<\/li><\/ul><\/li>\n\n
                        • Use Cases<\/strong>: When you need to associate keys with values, like looking up values by some identifier. Ideal for mappings or storing data in a way that makes it easily retrievable by its name or identifier.<\/li><\/ul>
                          • In Python versions < 3.7:<\/strong> is an unordered collection of data.<\/li>\n\n
                          • In Python v3.1:<\/strong> a new type of dictionary called \u2018OrderedDict\u2019 was introduced, which was similar to dictionary in python; the difference was that orderedDict was ordered (as the name suggests)<\/li>\n\n
                          • In the latest version of Python, i.e. 3.7<\/strong>: Finally, in python 3.7, dictionary is now an ordered collection of key-value pairs. The order is now guaranteed in the insertion order, i.e. the order in which they were inserted.<\/li><\/ul>

                            Syntax & Examples:<\/strong><\/p>

                            <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
                            dict1<\/span> <\/span>=<\/span> <\/span>{<\/span>"<\/span>key1<\/span>"<\/span>:<\/span> <\/span>"<\/span>value1<\/span>"<\/span>,<\/span> <\/span>"<\/span>key2<\/span>"<\/span>:<\/span> <\/span>"<\/span>value2<\/span>"<\/span>}<\/span><\/span>\ndict2<\/span> <\/span>=<\/span> <\/span>{}<\/span><\/span>\ndict3<\/span> <\/span>=<\/span> <\/span>dict<\/span>(<\/span>{<\/span>1<\/span>:<\/span> <\/span>"<\/span>one<\/span>"<\/span>,<\/span> <\/span>2<\/span>:<\/span> <\/span>"<\/span>two<\/span>"<\/span>}<\/span>)<\/span><\/span>\n<\/span>\nprint<\/span>(<\/span>dict1<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>dict2<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>dict3<\/span>)<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n{<\/span>'<\/span>key1<\/span>'<\/span>: <\/span>'<\/span>value1<\/span>'<\/span>,<\/span> <\/span>'<\/span>key2<\/span>'<\/span>: <\/span>'<\/span>value2<\/span>'<\/span>}<\/span><\/span>\n{}<\/span><\/span>\n{<\/span>1<\/span>: <\/span>'<\/span>one<\/span>'<\/span>,<\/span> <\/span>2<\/span>: <\/span>'<\/span>two<\/span>'<\/span>}<\/span><\/span><\/code><\/pre><\/div>

                            Indexing<\/strong><\/p>

                            <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
                            dict1<\/span> <\/span>=<\/span> <\/span>{<\/span>"<\/span>one<\/span>"<\/span>:<\/span> <\/span>1<\/span>,<\/span> <\/span>"<\/span>two<\/span>"<\/span>:<\/span> <\/span>2<\/span>,<\/span> <\/span>"<\/span>three<\/span>"<\/span>:<\/span> <\/span>3<\/span>}<\/span><\/span>\nprint<\/span>(<\/span>dict1<\/span>.<\/span>keys<\/span>())<\/span><\/span>\nprint<\/span>(<\/span>dict1<\/span>.<\/span>values<\/span>())<\/span><\/span>\nprint<\/span>(<\/span>dict1<\/span>[<\/span>'<\/span>two<\/span>'<\/span>])<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\ndict_keys<\/span>([<\/span>'<\/span>one<\/span>'<\/span>,<\/span> <\/span>'<\/span>two<\/span>'<\/span>,<\/span> <\/span>'<\/span>three<\/span>'<\/span>])<\/span><\/span>\ndict_values<\/span>([<\/span>1<\/span>,<\/span> <\/span>2<\/span>,<\/span> <\/span>3<\/span>])<\/span><\/span>\n2<\/span><\/span><\/code><\/pre><\/div>

                            Adding New Element<\/strong><\/p>

                            <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
                            dict1<\/span> <\/span>=<\/span> <\/span>{<\/span>"<\/span>India<\/span>"<\/span>:<\/span> <\/span>"<\/span>IN<\/span>"<\/span>,<\/span> <\/span>"<\/span>United States<\/span>"<\/span>:<\/span> <\/span>"<\/span>USA<\/span>"<\/span>,<\/span> <\/span>"<\/span>Algeria<\/span>"<\/span>:<\/span> <\/span>"<\/span>DZ<\/span>"<\/span>}<\/span><\/span>\ndict1<\/span>.<\/span>update<\/span>(<\/span>{<\/span>"<\/span>Aruba<\/span>"<\/span>:<\/span> <\/span>"<\/span>AW<\/span>"<\/span>}<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>dict1<\/span>)<\/span><\/span>\ndict1<\/span>.<\/span>pop<\/span>(<\/span>"<\/span>Algeria<\/span>"<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>dict1<\/span>)<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n{<\/span>'<\/span>India<\/span>'<\/span>: <\/span>'<\/span>IN<\/span>'<\/span>,<\/span> <\/span>'<\/span>United States<\/span>'<\/span>: <\/span>'<\/span>USA<\/span>'<\/span>,<\/span> <\/span>'<\/span>Algeria<\/span>'<\/span>: <\/span>'<\/span>DZ<\/span>'<\/span>,<\/span> <\/span>'<\/span>Aruba<\/span>'<\/span>: <\/span>'<\/span>AW<\/span>'<\/span>}<\/span><\/span>\n{<\/span>'<\/span>India<\/span>'<\/span>: <\/span>'<\/span>IN<\/span>'<\/span>,<\/span> <\/span>'<\/span>United States<\/span>'<\/span>: <\/span>'<\/span>USA<\/span>'<\/span>,<\/span> <\/span>'<\/span>Aruba<\/span>'<\/span>: <\/span>'<\/span>AW<\/span>'<\/span>}<\/span><\/span>\n<\/span><\/code><\/pre><\/div>

                            Deleting Element<\/strong><\/p>

                            <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
                            dict1<\/span> <\/span>=<\/span> <\/span>{<\/span>"<\/span>India<\/span>"<\/span>:<\/span> <\/span>"<\/span>IN<\/span>"<\/span>,<\/span> <\/span>"<\/span>United States<\/span>"<\/span>:<\/span> <\/span>"<\/span>USA<\/span>"<\/span>,<\/span> <\/span>"<\/span>Algeria<\/span>"<\/span>:<\/span> <\/span>"<\/span>DZ<\/span>"<\/span>}<\/span><\/span>\ndict1<\/span>.<\/span>pop<\/span>(<\/span>'<\/span>Algeria<\/span>'<\/span>)<\/span><\/span>\nprint<\/span>(<\/span>dict1<\/span>)<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n{<\/span>'<\/span>India<\/span>'<\/span>: <\/span>'<\/span>IN<\/span>'<\/span>,<\/span> <\/span>'<\/span>United States<\/span>'<\/span>: <\/span>'<\/span>USA<\/span>'<\/span>}<\/span><\/span><\/code><\/pre><\/div>

                            Sorting Elements<\/strong><\/p>

                            <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
                            dict1<\/span> <\/span>=<\/span> <\/span>{<\/span>"<\/span>India<\/span>"<\/span>:<\/span> <\/span>"<\/span>IN<\/span>"<\/span>,<\/span> <\/span>"<\/span>United States<\/span>"<\/span>:<\/span> <\/span>"<\/span>USA<\/span>"<\/span>,<\/span> <\/span>"<\/span>Algeria<\/span>"<\/span>:<\/span> <\/span>"<\/span>DZ<\/span>"<\/span>}<\/span><\/span>\nprint<\/span>(<\/span>sorted<\/span>(<\/span>dict1<\/span>))<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\n[<\/span>'<\/span>Algeria<\/span>'<\/span>,<\/span> <\/span>'<\/span>India<\/span>'<\/span>,<\/span> <\/span>'<\/span>United States<\/span>'<\/span>]<\/span><\/span><\/code><\/pre><\/div>

                            Searching Elements<\/strong><\/p>

                            <\/circle><\/circle><\/circle><\/g><\/svg><\/span><\/path><\/path><\/svg><\/span>
                            dict1<\/span> <\/span>=<\/span> <\/span>{<\/span>"<\/span>India<\/span>"<\/span>:<\/span> <\/span>"<\/span>IN<\/span>"<\/span>,<\/span> <\/span>"<\/span>United States<\/span>"<\/span>:<\/span> <\/span>"<\/span>USA<\/span>"<\/span>,<\/span> <\/span>"<\/span>Algeria<\/span>"<\/span>:<\/span> <\/span>"<\/span>DZ<\/span>"<\/span>}<\/span><\/span>\nprint<\/span>(<\/span>dict1<\/span>[<\/span>'<\/span>Algeria<\/span>'<\/span>])<\/span><\/span>\n<\/span>\n#<\/span>OUTPUT<\/span><\/span>\nDZ<\/span><\/span><\/code><\/pre><\/div>

                            NOTE: An unordered collection lacks a data structure that maintains the order in which the data was added. An ordered collection, on the other hand, has a data structure that does.<\/p>

                            • A dictionary (in Python v3.6 and earlier) may appear ordered, but it is not; sets, on the other hand, are an unordered collection. While it does save the keys that have been added to it, accessing via the key is still possible, but not at a precise integer index.<\/li>\n\n
                            • In a dictionary, every key is distinct and serves as an index via which you can get values. However, a dictionary’s key storage is not kept in the order that they are entered, making it unordered. Python 3.1’s “OrderedDict” and Python 3.7’s Dictionary, on the other hand, are ordered collections of key-value data since they preserve the insertion order.<\/li><\/ul>

                              Key Differences Between Dictionary, List, Set, and Tuple<\/p>

                              Syntax<\/h3>
                              • Dictionary:<\/strong>\u00a0Key-value pairs are enclosed in curly brackets {} and separated by commas.<\/li>\n\n
                              • List:<\/strong>\u00a0Uses square brackets [] to denote entries separated by commas.<\/li>\n\n
                              • Set:<\/strong>\u00a0Comma-separated elements using curly brackets { }.<\/li>\n\n
                              • Tuple:<\/strong>\u00a0Uses parenthesis() to divide components with commas.<\/li><\/ul>

                                Order<\/h3>
                                • Dictionary:<\/strong>\u00a0In Python 3.7+, it keeps order; in Python 3.6, it is unordered.<\/li>\n\n
                                • List:<\/strong>\u00a0Maintains order.<\/li>\n\n
                                • Set:<\/strong>\u00a0Not arranged.<\/li>\n\n
                                • Tuple:<\/strong>\u00a0Maintains order.<\/li><\/ul>

                                  Duplicate Data<\/h3>
                                  • Dictionary:<\/strong> Keys are unique, values can be duplicated.<\/li>\n\n
                                  • List:<\/strong> Allows duplicate elements.<\/li>\n\n
                                  • Set:<\/strong> Does not allow duplicate elements.<\/li>\n\n
                                  • Tuple:<\/strong> Allows duplicate elements.<\/li><\/ul>

                                    Indexing<\/h3>
                                    • Dictionary:<\/strong> Key-based indexing.<\/li>\n\n
                                    • List:<\/strong> Integer-based indexing starting from 0.<\/li>\n\n
                                    • Set:<\/strong> No index-based mechanism.<\/li>\n\n
                                    • Tuple:<\/strong> Integer-based indexing starting from 0.<\/li><\/ul>

                                      Adding Elements<\/h3>
                                      • Dictionary:<\/strong> Uses key-value pairs.<\/li>\n\n
                                      • List:<\/strong> New items can be added using append() method.<\/li>\n\n
                                      • Set:<\/strong> Uses add() method.<\/li>\n\n
                                      • Tuple:<\/strong> Being immutable, new data cannot be added.<\/li><\/ul>

                                        Deleting Elements<\/h3>
                                        • Dictionary:<\/strong> Uses pop(key) method to remove specified key and value.<\/li>\n\n
                                        • List:<\/strong> Uses pop() method to delete an element.<\/li>\n\n
                                        • Set:<\/strong> Uses pop() method to remove an element.<\/li>\n\n
                                        • Tuple:<\/strong> Being immutable, no data can be popped or deleted.<\/li><\/ul>

                                          Sorting Elements<\/h3>
                                          • Dictionary:<\/strong> Keys can be sorted using the sorted() method.<\/li>\n\n
                                          • List:<\/strong> Uses sort() method to sort elements.<\/li>\n\n
                                          • Set:<\/strong> Unordered, so sorting is not applicable.<\/li>\n\n
                                          • Tuple:<\/strong> Being immutable, data cannot be sorted.<\/li><\/ul>

                                            Searching Elements<\/h3>
                                            • Dictionary:<\/strong> Uses the get(key) method to retrieve value for a specified key.<\/li>\n\n
                                            • List:<\/strong> Uses index() method to search and return index of first occurrence.<\/li>\n\n
                                            • Set:<\/strong> Unordered, so searching is not applicable.<\/li>\n\n
                                            • Tuple:<\/strong> Uses index() method to search and return index of first occurrence.<\/li><\/ul>

                                              Reversing Elements<\/h3>
                                              • Dictionary:<\/strong> No integer-based indexing, so no reversal.<\/li>\n\n
                                              • List:<\/strong> Uses reverse() method to reverse elements.<\/li>\n\n
                                              • Set:<\/strong> Unordered, so reversing is not advised.<\/li>\n\n
                                              • Tuple:<\/strong> Being immutable, reverse method is not applicable.<\/li><\/ul>

                                                Counting Elements<\/h3>
                                                • Dictionary:<\/strong> count() not defined for dictionaries.<\/li>\n\n
                                                • List:<\/strong> Uses count() method to count occurrence of a specific element.<\/li>\n\n
                                                • Set:<\/strong> count() is not defined for sets.<\/li>\n\n
                                                • Tuple:<\/strong> Uses count() method to count occurrence of a specific element.<\/li><\/ul>

                                                  Conclusion<\/h2>

                                                  In the realm of Python programming, the distinction between lists and tuples is primarily founded on their mutability; lists are characterized by their ability to be modified after creation, making them mutable, while tuples stand out for their immutability, remaining constant post-initialization. Regarding sets, they hold the unique position of being the sole unordered collection type within Python 3.7, distinguishing them from other collection types through their lack of order. The classification of dictionaries within Python, however, has been a subject of ongoing debate due to their ordering behavior, which has evolved across different versions of the language. Prior to Python 3.7, dictionaries were generally considered unordered. This perception began to shift with the introduction of the OrderedDict in Python 3.1, a specialized dictionary maintaining elements in their insertion order. The evolution continued, and with the advent of Python 3.7, both the traditional dictionary and OrderedDict are recognized as ordered collections, marking a significant milestone in Python’s treatment of key-value pair data structures.<\/p>

                                                  Leave a response to this article by providing your insights, comments, or requests for future articles.<\/strong> Share the articles with your friends and colleagues on social media.<\/strong><\/p>","protected":false},"excerpt":{"rendered":"

                                                  Dive deep into Python’s core data structures as we explore the unique characteristics and use cases of lists, tuples, sets, and dictionaries, making your coding journey smoother and more efficient<\/p>\n","protected":false},"author":2,"featured_media":401,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,16],"tags":[20,21,18,19,95,36,52,56,32,31,96,97],"class_list":["post-399","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","category-python","tag-google","tag-medium","tag-python","tag-python3","tag-dictionary","tag-django","tag-flask","tag-learnpython","tag-programmingtips","tag-pythondev","tag-sets","tag-tuple"],"yoast_head":"\nDifferences Between List, Tuple, Set and Dictionary in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣<\/title>\n<meta name=\"description\" content=\"Unravel the mysteries of Python's data structures with a comprehensive guide on the differences between lists, tuples, sets, and dictionaries. Perfect for beginners and seasoned coders alike.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Differences Between List, Tuple, Set and Dictionary in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣\" \/>\n<meta property=\"og:description\" content=\"Unravel the mysteries of Python's data structures with a comprehensive guide on the differences between lists, tuples, sets, and dictionaries. Perfect for beginners and seasoned coders alike.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"🌟Code with MrCoder7️⃣0️⃣1️⃣\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-05T18:13:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-05T18:20:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2240\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"mr.coder\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"mr.coder\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/\"},\"author\":{\"name\":\"mr.coder\",\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d\"},\"headline\":\"Differences Between List, Tuple, Set and Dictionary in Python\",\"datePublished\":\"2024-03-05T18:13:49+00:00\",\"dateModified\":\"2024-03-05T18:20:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/\"},\"wordCount\":1360,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d\"},\"image\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png\",\"keywords\":[\"#google\",\"#medium\",\"#python\",\"#python3\",\"dictionary\",\"Django\",\"flask\",\"learnpython\",\"ProgrammingTips\",\"PythonDev\",\"sets\",\"tuple\"],\"articleSection\":[\"Programming\",\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/\",\"url\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/\",\"name\":\"Differences Between List, Tuple, Set and Dictionary in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣\",\"isPartOf\":{\"@id\":\"https:\/\/www.mrcoder701.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png\",\"datePublished\":\"2024-03-05T18:13:49+00:00\",\"dateModified\":\"2024-03-05T18:20:58+00:00\",\"description\":\"Unravel the mysteries of Python's data structures with a comprehensive guide on the differences between lists, tuples, sets, and dictionaries. Perfect for beginners and seasoned coders alike.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#primaryimage\",\"url\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png\",\"contentUrl\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png\",\"width\":2240,\"height\":1260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.mrcoder701.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Differences Between List, Tuple, Set and Dictionary in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.mrcoder701.com\/#website\",\"url\":\"https:\/\/www.mrcoder701.com\/\",\"name\":\"Blog With MrCoder701\",\"description\":\"Blog related to programming\",\"publisher\":{\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.mrcoder701.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d\",\"name\":\"mr.coder\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/06\/369B947D-A5EE-4B16-816A-5EE55D1DDF96_L0_001-10_6_2024-6-13-24-PM.png\",\"contentUrl\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/06\/369B947D-A5EE-4B16-816A-5EE55D1DDF96_L0_001-10_6_2024-6-13-24-PM.png\",\"width\":500,\"height\":500,\"caption\":\"mr.coder\"},\"logo\":{\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/mrcoder701.com\",\"https:\/\/www.instagram.com\/mr_coder_701\/\",\"https:\/\/www.youtube.com\/@mrcoder701\"],\"url\":\"https:\/\/www.mrcoder701.com\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Differences Between List, Tuple, Set and Dictionary in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣","description":"Unravel the mysteries of Python's data structures with a comprehensive guide on the differences between lists, tuples, sets, and dictionaries. Perfect for beginners and seasoned coders alike.","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:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/","og_locale":"en_US","og_type":"article","og_title":"Differences Between List, Tuple, Set and Dictionary in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣","og_description":"Unravel the mysteries of Python's data structures with a comprehensive guide on the differences between lists, tuples, sets, and dictionaries. Perfect for beginners and seasoned coders alike.","og_url":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/","og_site_name":"🌟Code with MrCoder7️⃣0️⃣1️⃣","article_published_time":"2024-03-05T18:13:49+00:00","article_modified_time":"2024-03-05T18:20:58+00:00","og_image":[{"width":2240,"height":1260,"url":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png","type":"image\/png"}],"author":"mr.coder","twitter_card":"summary_large_image","twitter_misc":{"Written by":"mr.coder","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#article","isPartOf":{"@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/"},"author":{"name":"mr.coder","@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d"},"headline":"Differences Between List, Tuple, Set and Dictionary in Python","datePublished":"2024-03-05T18:13:49+00:00","dateModified":"2024-03-05T18:20:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/"},"wordCount":1360,"commentCount":3,"publisher":{"@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d"},"image":{"@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png","keywords":["#google","#medium","#python","#python3","dictionary","Django","flask","learnpython","ProgrammingTips","PythonDev","sets","tuple"],"articleSection":["Programming","Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/","url":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/","name":"Differences Between List, Tuple, Set and Dictionary in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣","isPartOf":{"@id":"https:\/\/www.mrcoder701.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#primaryimage"},"image":{"@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png","datePublished":"2024-03-05T18:13:49+00:00","dateModified":"2024-03-05T18:20:58+00:00","description":"Unravel the mysteries of Python's data structures with a comprehensive guide on the differences between lists, tuples, sets, and dictionaries. Perfect for beginners and seasoned coders alike.","breadcrumb":{"@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#primaryimage","url":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png","contentUrl":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png","width":2240,"height":1260},{"@type":"BreadcrumbList","@id":"https:\/\/www.mrcoder701.com\/2024\/03\/05\/differences-between-list-tuple-set-and-dictionary-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mrcoder701.com\/"},{"@type":"ListItem","position":2,"name":"Differences Between List, Tuple, Set and Dictionary in Python"}]},{"@type":"WebSite","@id":"https:\/\/www.mrcoder701.com\/#website","url":"https:\/\/www.mrcoder701.com\/","name":"Blog With MrCoder701","description":"Blog related to programming","publisher":{"@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mrcoder701.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d","name":"mr.coder","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/image\/","url":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/06\/369B947D-A5EE-4B16-816A-5EE55D1DDF96_L0_001-10_6_2024-6-13-24-PM.png","contentUrl":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/06\/369B947D-A5EE-4B16-816A-5EE55D1DDF96_L0_001-10_6_2024-6-13-24-PM.png","width":500,"height":500,"caption":"mr.coder"},"logo":{"@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/mrcoder701.com","https:\/\/www.instagram.com\/mr_coder_701\/","https:\/\/www.youtube.com\/@mrcoder701"],"url":"https:\/\/www.mrcoder701.com\/author\/admin\/"}]}},"rttpg_featured_image_url":{"full":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png",2240,1260,false],"landscape":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png",2240,1260,false],"portraits":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png",2240,1260,false],"thumbnail":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7-150x150.png",150,150,true],"medium":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7-300x169.png",300,169,true],"large":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7-1024x576.png",1024,576,true],"1536x1536":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7-1536x864.png",1536,864,true],"2048x2048":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7-2048x1152.png",2048,1152,true],"woocommerce_thumbnail":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7-300x300.png",300,300,true],"woocommerce_single":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7.png",600,338,false],"woocommerce_gallery_thumbnail":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/03\/Wardiere-In.-7-150x150.png",150,150,true]},"rttpg_author":{"display_name":"mr.coder","author_link":"https:\/\/www.mrcoder701.com\/author\/admin\/"},"rttpg_comment":3,"rttpg_category":"<a href=\"https:\/\/www.mrcoder701.com\/category\/programming\/\" rel=\"category tag\">Programming<\/a> <a href=\"https:\/\/www.mrcoder701.com\/category\/python\/\" rel=\"category tag\">Python<\/a>","rttpg_excerpt":"Dive deep into Python's core data structures as we explore the unique characteristics and use cases of lists, tuples, sets, and dictionaries, making your coding journey smoother and more efficient","_links":{"self":[{"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/posts\/399","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/comments?post=399"}],"version-history":[{"count":2,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/posts\/399\/revisions"}],"predecessor-version":[{"id":402,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/posts\/399\/revisions\/402"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/media\/401"}],"wp:attachment":[{"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/media?parent=399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/categories?post=399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/tags?post=399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}