Python Beginners Learn the basics of data structures-cognition of data structures

Source: Internet
Author: User
Tags set set

What is a data structure?

Data structure refers to the existence of one or more relationships between the collection of elements and the data elements in the collection of the relationship between the composition.

Here's an example to understand this data structure:

Data can be likened to books, data structure equivalent to bookshelves, books stored on the shelves, to hold books, we get the shelves to fetch. In order to get the desired book faster, you can arrange the book in a certain way. For example, the shelves into the N-level, (Cartoon book on the first floor, literature book on the second floor ...) Different kinds of books are placed in different layers of the bookshelf.

This is an understanding of the popular data structure.

Data structure classification of Python

Data structures in Python can be collectively referred to as Containers (container, the container that holds the data), and it has three types: sequences (lists and tuples), collections (sets), and mappings (such as dictionaries):

List of lists for example: List1 = [' P ', ' y ', ' t ', ' h ', ' o ', ' n ']

Tuple tuples For example: Tuple1 = (' P ', ' y ', ' t ', ' h ', ' o ', ' n ')

Set set for example: set1={' P ', ' y ', ' t ', ' h ', ' o ', ' n '}

Dictionary dict For example: Dict1 ={1: ' P ', 2: ' Y ', 3: ' t ', 4: ' H ', 5: ' O ', 6: ' N '}

What are the differences and effects of these data structures? Our next article combines some practical methods of data structure manipulation to introduce them individually. To learn more in advance, go to the Code Bud Internet Café:Http://www.mayacoder.com/lesson/index

Python Beginners Learn the basics of data structures-cognition of data structures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.