Lists and Tuples

Learning Objectives

By the end of this chapter, you will be able to:

  • Create and access lists in Python
  • Describe the various methods that are available in lists, and use them in your Python programs
  • Create and access tuples in Python
  • Identify the differences between tuples and lists
  • Implement the various built-in methods that are available with tuples

This lesson introduces lists and tuples in Python. We also look at the various list and tuple methods.

Introduction

A list is a data structure that holds ordered collections of related data. Lists are known as arrays in other programming languages, like Java, C, and C++. Python lists, however, are more flexible and powerful than the traditional arrays of other languages. ...

Get Python Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.