Introduction
Displaying values
Variables
The print function
List basics
21. Checking list size
Summary

Instruction

That’s correct! To check the size of your list (i.e. the number of elements in your list), use the len(list_name) function.

# define a list
canadian_cities = [
    'Toronto', 'Montreal', 'Calgary', 'Ottawa',
    'Edmonton', 'Mississauga', 'Winnipeg', 'Vancouver', 
    'Brampton', 'Familton']

# should equal 10
len(canadian_cities)

The expression len(list_name) returns an integer – the number of elements in a list.

Exercise

Show the length of the list provided in the template.

Stuck? Here's a hint!

Use len(daily_sales).