directory

  • A preface.
  • Python set list dict tuple
  • Guess you like it

Recommended path for learning Python: Python Learning Directory >> Python Basics

A preface.

Python provides a variety of data types to store collections of data items, including sequences (lists and tuples), maps (such as dict), and sets. Each of these data types is described below.

The main differences between lists, tuples, dict and sets in Python: A tuple is an immutable list, and a set is a dict with no Value. Lists, dict and sets are mutable, and tuples are immutable!

Python set list dict tuple

  • Lists are the freest, indexed, sliced, calculated and modified;
  • Tuples are not free. The data cannot be changed, but like lists, they have sequences that can be indexed and sliced.
  • Dict is composed of unordered key-value pairs. You can index the value of a value by using a key. You can modify the corresponding value by using a key.
  • Sets are unordered and non-repetitive, similar to dictionaries, which are represented by brackets {}, except that dictionaries are key-value pairs, whereas sets are composed of data or elements or lists.

Guess you like it

  1. Python string/list/tuple/dictionary conversions
  2. Python local and global variables
  3. The Python type function is different from the isinstance function
  4. Python is differs from ==
  5. Python mutable and immutable data types
  6. Shallow and deep copies of Python
  7. Python recursive functions
  8. Python sys module
  9. The Python list
  10. The Python tuple tuple
  11. Python dictionary dict
  12. Python conditional derivations
  13. Python list derivations
  14. Python dictionary derivations
  15. Python function declarations and calls
  16. Python variable argument *argc/**kargcs

Python set list dict tuple differentiates and converts between dict tuples

This article is published by the blog – Ape Say Programming Ape Say programming!