List and tuple types

Source: Internet
Author: User
List lists are an ordered set of elements that can be added and removed at any time, l=[] The index starts at 0, the index of the first element is 0, the second is 1, the penultimate is-1, the second-to-last is-2, and so on, using the index, do not cross-border append () Always add new elements to the end of list, write L.append () insert () accepts two parameters, one is the index number, and the second is the new element to be added. L.insert (0, ' Paul '), ' Paul ' will be added to the first, originally 0 and later elements, all automatically move backwards one bit, or direct d[] pop () always delete the last element of the list, L.pop (2) Delete the element of index 2 l[2]= ' Paul ' , directly replacing the element of index 2 tuple is another ordered list, called a tuple, similar to list, but once the tuple is created, it cannot be modified. t= () Add a comma when you create a tuple of cells

List and tuple types

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.