Login
📚 Introduction to Python Programming
Chapters ▾
⇩ Download ▾

9.3 Common list operations

Learning objectives

By the end of this section you should be able to

  • Use built-in functions max, min, and sum.
  • Demonstrate how to copy a list.

Using built-in operations

The max function called on a list returns the largest element in the list. The min function called on a list returns the smallest element in the list. The max and min functions work for lists as long as elements within the list are comparable.

The sum function called on a list of numbers returns the sum of all elements in the list.

Copying a list

The copy method is used to create a copy of a list.

Adapted from Introduction to Python Programming by OpenStax (openstax.org), licensed under CC BY-NC-SA 4.0. Changes were made. License: CC-BY-NC-SA-4.0.