- [Narrator] In Python, any object can be…tested for Boolean truth value.…So, let's take a few moments now…to learn about how that works.…In general, any object is considered…to be equivalent to Boolean true,…unless it's class defines a Bool method that returns false,…or has a len method that returns a zero length.…So, let's look first at the built-in…objects that evaluate to false.…There are two constants which are defined to evaluate…to false, the false Boolean constant itself,…of course, and the none constant, which you may…have seen represented in other languages as null.…
Any of the built-in numeric types that evaluate to zero…are also considered to be false.…For example, the integer value zero,…the floating-point value 0.0,…and the complex value type of 0j are all false values.…In addition, the decimal object, when given a value of zero,…and the fractional object,…when it has a numerator of zero, are also false.…Next are empty sets and sequences.…And you can see the examples here.…The empty string and empty collection objects…
- Truth value testing
- Template strings
- Advanced Python functions
- Advanced collections
- Advanced classes and objects
- Python comprehensions: list, dictionary, and set
Skill Level Advanced
1. Python Language Features
2. Built-In Functions
3. Advanced Python Functions
4. Advanced Collections
5. Advanced Classes and Objects
6. Using Logging
7. Python Comprehensions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.