Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Standalone functions are great but when we're writing small functions, we often need to do more work than we can achieve in a single function. Luckily, we can chain functions so long as we write them correctly.
Since filter()
, map()
, sorted()
, and friends all return iterables, we can chain them together. Chained functions resolve, or happen, from the inside out, so the innermost function runs first.
This is another reason why functions usually return
a value at the end. It makes it easier to use them all together.
any(iterable)
returns True
if any of the items in the iterable are truthy. Similar is the function all()
. all(iterable)
returns True
if all of the items in the iterable are truthy.
Watch our comprehensions workshop if you want more information.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Mark Chesney
11,747 Points1 Answer
-
AJ Salmon
5,675 Points1 Answer
-
MOD
Iain Simmons
Treehouse Moderator 32,305 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up