Python · live now

Built-in functions

The functions Python gives you without importing anything: sorted(), the numerical aggregations, all() and any(), and enumerate() for index and value together.

No account needed to read a lesson · 30-day money-back guarantee

See the full learning path

6

lessons

46

practice questions

41

prerequisite lessons

See it taught

1 of the 6 lessons here is free to preview - the whole explanation and worked example, with no account and no email.

The editor you get

A still of the editor, not a live one

Python Editor

1 2
scores = [7, 3, 9] print(sorted(scores), max(scores))

Editor Output

1

Output:

[3, 7, 9] 9

You write and run Python in the browser - nothing to install, no setup. Questions are marked on the values your code produces. The snippet here is an example of the kind of code you write.

The 6 lessons

The 6 lessons in this unit. Expand any one to see what it covers. Each unlocks when its own prerequisites are passed.

01

Built-in functions

4 questions

Understand what built-in functions in Python are and see how to use the abs() function to find the absolute value of numbers regardless of their sign.

Covers

Overview of built-in functions

The abs() function

02

Sorting numbers and strings with sorted()

9 questions

Learn how to use Python's sorted() function to create sorted lists of numbers or strings in ascending or descending order, and see how case sensitivity affects the sorting of strings.

Covers

Sorting numbers

Sorting lists of strings

03

Built-in numerical aggregation functions

12 questions

Learn how to use Python's built-in min(), max(), and sum() functions to efficiently find the smallest, largest, and total values in collections of numbers.

Covers

The min() function

The max() function

The sum() function

04

The all() and any() functions

8 questions

Learn how to use Python's built-in all() and any() functions to determine whether all or any elements in an iterable are true, and understand the behaviour of these functions with different types of elements and empty iterables.

Covers

The all() function

The any() function

05

The enumerate() function

Preview

8 questions

Learn how the enumerate() function in Python allows simultaneous iteration over items and their indices, with the option to specify a custom starting index for the counter.

Covers

The enumerate() function

Specifying a starting value

Preview this lesson - no account needed

06

Activity: treasure hunt

5 questions

Practise writing Python code to calculate distances, assign values and difficulty levels, interpret clues, and summarise locations in a treasure hunt scenario.

Covers

Distance to treasure

Treasure values

Treasure recovery difficulty

Treasure clues

Treasure hunt site summary

Where this unit sits in the curriculum

This unit is part of our Python Done Right learning path, which contains 100 lessons. Every one of them is drawn below.

The diagnostic test lets you skip any lesson you already know, including the ones in this unit.

Every dot is a lesson and every line a prerequisite. The 6 red dots are the lessons in Built-in functions; the 41 blue dots feeding into them are the lessons Built-in functions depends on; the 53 pale dots are the rest of the learning path, which come after Built-in functions or alongside it.Built-in functionsFirst lessons on the left100 lessons

Hover any dot to name its lesson.

6 lessons in this unit

41 prerequisite lessons across the unit, counting every step back to the start

53 other lessons in the learning path - after this unit, or alongside it

Every dot is a lesson, every line a prerequisite. You can only start a lesson once you have mastered all of its prerequisites, so you are always building on solid foundations.

Start Built-in functions

One subscription covers every learning path, and you can test out of anything you already know.

One subscription covers every learning path · 30-day money-back guarantee

More in Functions: User-defined functions