Often, we’ll need to find the number of items in a list, usually called its length.

We can do this using a built-in function called len().

When we apply len() to a list, we get the number of elements in that list:

my_list = [1, 2, 3, 4, 5] print(len(my_list))

Would output:


Let’s find the length of various lists!



Calculate the length of long_list and save it to the variable long_list_len.


Use print() to examine long_list_len.


We have provided a completed range() function for the variable range_list.

Calculate its length using the function len() and save it to a variable called range_list_length.

Note: Range objects do not need to be converted to lists in order to determine their length


Use print() to examine range_list_length.


Change the range() function that generates range_list so that it skips 100 instead of 10 steps between items.

How does this change range_list_length?

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?