prompt also watch for related discussion in operator overloading in part viwhen we define new object types with classeswe can specify their boolean nature with either the __bool__ or __len__ methods (__bool__ is named __nonzero__ in the latter of these is tried if the former is absent and designates false by returning length of zero--an empty object is considered false finallyand as previewother tools in python have roles similar to the or chains at the start of this sidebarthe filter call and list comprehensions we'll meet later can be used to select true values when the set of candidates isn' known until runtime (though they evaluate all values and return all that are true)and the any and all built-ins can be used to test if any or all items in collection are true (though they don' select an item) [ 'spam''''ham'[]list(filter(booll)[ 'spam''ham'[ for in if [ 'spam''ham'any( )all( (truefalseget true values comprehensions aggregate truth as seen in the bool function here simply returns its argument' true or false valueas though it were tested in an if watch for more on these related tools in and summary in this we studied the python if statement additionallybecause this was our first compound and logical statementwe reviewed python' general syntax rules and explored the operation of truth values and tests in more depth than we were able to previously along the waywe also looked at how to code multiway branching in pythonlearned about the if/else expression introduced in python and explored some common ways that boolean values crop up in code the next continues our look at procedural statements by expanding on the while and for loops therewe'll learn about alternative ways to code loops in pythonsome of which may be better than others before thatthoughhere is the usual quiz test your knowledgequiz how might you code multiway branch in python how can you code an if/else statement as an expression in python how can you make single statement span many linestest your knowledgequiz