Python's len() Function (Summary)
This course covered how len() works and how to apply it to different data types. You learned how to:
- Find the length of built-in data types using
len()
- Use
len()
with third-party data types - Provide support for
len()
with user-defined classes
For more information on concepts covered in this course, you can check out:
- NumPy Tutorial: Your First Steps Into Data Science in Python
- Using Pandas and Python to Explore Your Dataset
- The Pandas DataFrame: Make Working With Data Delightful
- Python’s
len()
documentation
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00
In the previous lesson, I showed you how to implement __len__()
and make your own objects work with the len()
function. In this lesson, I’ll give you a quick summary of the course.
00:10
This course was all about the built-in len()
function. You learned how it works with container-like objects to return their length. You saw demonstrations with built-in data types, such as sequences and collections. You wrote your own version of __len__()
and saw how Python gets the lengths of things with len()
.
00:28 And you saw how the writers of NumPy and Pandas used this very same feature to return mostly reasonable values for their multi-dimensional arrays and DataFrames, respectively. Thanks for your attention.
Become a Member to join the conversation.