Loading topic
if statements. It also assumes you are familiar with the built-in types int, str, list, and dict. You do not need to know anything about comparison operators, None, or truthiness yet. Later chapters cover those 5 min readif statements) and the built-in types int, str, list, and dict. You have already met True and False. Here you learn how Python decides whether any object counts as true or false when a condition expects a boolea5 min readif statements. It also assumes you know the built-in types int, float, str, list, tuple, dict, and set. It covers what the six comparison operators do for each of those types, when a comparison raises an error instead of 5 min read1 < x <= 10. It assumes you know basic Python syntax, the built-in types int, str, list and dict, and the comparison operators from the previous chapter. It also assumes you know that and and or6 min readbool values, truthiness, and comparison operators work, as covered in the earlier chapters. You should also be comfortable writing if statements and small functions. Here you will learn how and, or, and not combine conditions, how they group when you mix t6 min readTrue or False. It also assumes you can read basic if statements and function definitions. Here you will see that and and or are not just "boolean operators". They pick6 min readif statements) and the built-in types int, str, list, and dict. It also assumes you have met truthiness in an earlier chapter. Here you learn what None is, where it comes from, and how it fails when you misuse it. T5 min readNone works, and how to define a simple class. You should also know that variables hold references to objects, not copies of them. By the end you will be able to say which question each operator asks, predict results when objects are sh6 min readif statements. It also assumes you know the earlier chapters' main points: None is a single object of type NoneType, every object has a truth value, and is tests identity while == tests equality. Here you will apply th5 min readint, str, list, and dict. It also assumes you have met True, False, and truthiness in earlier chapters. Here you will see how bool is built on top of int, what that allows, and where it can mislead you.6 min readany() and all(), the two built-ins that reduce a whole iterable of values to a single bool. It assumes you know truthiness, and/or/not, short-circuiting, and generator expressions at a basic level. The earlier chapters on those topics cover the rest.5 min readNone. It assumes you know the basics of bool, truthiness, and/or/not, and the difference between is and ==. Each pitfall below shows the failure, explains the mechanism behind it, a6 min read==, is, and None checks work for built-in types. Here you apply those rules to your own classes. You will control what if obj: does and what obj == other means. You will also see how those choices interact with None checks, hashing, and conta6 min read