Tuesday, June 19, 2018

Sequences: Strings, Lists, and Tuples

                              Sequences: Strings, Lists, and Tuples 

we have looked at variables that hold a single value. A  sequence  is a variable that holds multiple values as an array. Each element can be addressed by its position in the sequence as an offset from the first element. The three types of sequence are as follows:

     Strings   : A sequence of characters that together form a text string. 

•     Lists   : A sequence of values where each value can be accessed using an offset from the first entry in the list. 

•     Tuples   : A sequence of values, very much like a list, but the entries in a tuple are immutable; they cannot be changed
.   
 We’ll look at the Python features that are common to all sequences and then look at the three types separately. 

No comments:

Post a Comment