Python Programming - Sequence Data Types

You can learn about Strings in Python Programs with Outputs helped you to understand the language better.

Python Programming – Sequence Data Types

A sequence is an ordered collection of items, indexed by positive integers. It is a combination of mutable (a mutable variable is one, whose value may change) and immutable (an immutable variable is one, whose value may not change) data types. There are three types of sequences available in Python; they are Strings, Lists, and Tuples. They share much of the same syntax and functionality. The string is an ordered sequence of letters/characters. For example, your name can be considered a string. Strings are defined using quotes – single quotes (”), double quotes (“”) or triple quotes (“””). The list is also a sequence of values of any type.

Lists are defined using square brackets and commas. Tuples are a sequence of values of any type and are indexed by integers. They are defined using parentheses (and commas). You can access individual members of a string, list, or tuple using square bracket “array” notation. We will cover Sequence Data Types – List and Tuple in Chapters 7 and 8, respectively.

Leave a Reply

Your email address will not be published. Required fields are marked *