python-the difference between array and list, the difference between tuple and set---interview question 1

Source: Internet
Author: User

The difference between a list of arrays and lists in Python, the difference between tuple tuples and lists, and the note that tuples are tuples, set is set:

Python does not have an array:

  1. Only tuples (tuple) and lists (list);

  2. Once the tuple has been created, it cannot be changed, for example: Aa=tuple (n/a);

  3. Tuples cannot append (append) elements, pop (pop) elements, etc.;

  4. Only the elements in a tuple can be indexed aa[0], and the tuples in them cannot be assigned aa[0]=8;

  5. The advantage of using tuples is that it is more efficient to operate on tuples, which is suitable for storing a set of constants;

  6. And many of the above can not, using the list is possible.

python-the difference between array and list, the difference between tuple and set---interview question 1

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.