Comparing and Choosing

Let's see how we can compare objects and make decisions in Python.

Coding is not just about writing a linear set of commands to execute. Sometimes, we need the code to behave in a certain way in one situation and another way in a different situation. To make decisions, however, we first need to assess the situation. We should be able to distinguish between the conditions to act accordingly. Did you notice at some point that Edward had some intelligence and could distinguish between things? If you did not, try interacting with the print_info() button in the widget below.

Get hands-on with 1200+ tech skills courses.