You’ve learned the ins and outs of using any()
in Python and the differences between any()
and or
. You’ve also explored short-circuiting and using list comprehensions with any()
. With a deeper understanding of these two tools, you’re well prepared to decide between them in your own code.
In this course, you learned how to:
- Use
any()
andnot any()
- Elimate long
or
chains - Use
any()
with list comprehensions - Evalute values that aren’t explicitly
True
orFalse
- Distinguish between
any()
andor
- Use short-circuiting
For more information on concepts covered in this course, you can check out:
- Understanding Python List Comprehensions
- Conditional Statements in Python
- How to Use Generators and yield in Python
- Python Booleans: Optimize Your Code With Truth Values
- Using the “or” Boolean Operator in Python
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.
deepakpatrick on Feb. 27, 2022
The last print output seems counter intuitive