Exercise

Truthy, True, Falsey, and False

While comparisons check for truthiness, something being truthy is not the same as it being True. The inverse of that statement is also true about falsey values and them not being False. So we need to be vigilent when we are checking is something is True or False vs truthy or falsey. In Python, we have the is operator to check if two things are identical. This time we'll be using a penguin details record dictionary which has the same keys as the prior exercise (species, flipper_length, body_mass, sex) with the tracked key that has a boolean value.

We loaded a dictionary, penguin_305_details, with all the details of a singular penguin's data.

Instructions

100 XP
  • Check the truthiness of penguin_305_details sex key.
    • If true, check if sex is True and store it as sex_is_true.
    • Print the sex key and sex_is_true.
  • Check the truthiness of penguin_305_details tracked key.
    • If true, check if tracked is True and store it as tracked_is_true.
    • Print the tracked key and tracked_is_true.