Python Learning note 05-sequences, tuples

Source: Internet
Author: User

Sequence: Consists of a string, a tuple, a list

There are two features: You can use the index operator and the slice operator

Index can be negative, str[-1] means the last element is taken out

The slice operator is a sequence name followed by a square bracket

Basic operator: Len () to derive sequence length

Min () to derive the smallest value in the sequence

Max () draws the largest value in the sequence

+ Connect two sequences

* Repeating sequence elements, followed by repetitions

In determining whether a string is judged in a sequence, the character needs to be quoted.

CMP (STR1,STR2) compares two sequence values for the same greater than return 1, which is less than return-1, equals return 0

A variable can be applied when a label has no quotation marks, and a normal character is represented by quotation marks

Tuple: Definition mode t= ("A", 2, "D")

When you define a value, you enclose the quotation marks

Assignment Another method a,b,c= (one-way)

Python Learning note 05-sequences, tuples

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.