Book Image

Sage Beginner's Guide

By : Craig Finch
1 (1)
Book Image

Sage Beginner's Guide

1 (1)
By: Craig Finch

Overview of this book

Table of Contents (17 chapters)
Sage Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Sequence types: lists, tuples, and strings


Python has seven compound data types that are known as sequence types because they are used to represent sequences of items. In this section, we will learn about three of the most commonly used sequence types. We'll start with lists, and learn many ways to create and manipulate them. The concepts we learn will then be applied to tuples and strings.

Lists in Python are similar in concept to arrays in C and Fortran, and equivalent to lists in Mathematica and vectors in MATLAB. Python lists are much more powerful and flexible than arrays in lower-level programming languages like C.