The Zoo Keeper’s Puzzles

Learning Objectives:

This set of puzzles will improve your Python skills when using If Statements (Selection)
You will focus on:

  • Using comparison operators: ==, !=, < , >, <=, >=
  • Using Boolean Operators: AND, OR, NOT

if statements use comparison operators to compare values and make a decision based on the comparison.

The main comparison operators are:

Comparison Operator Meaning Example
== is equal to 4==4
!= is different from 4!=7
< is lower than 3<5
> is greater than 9>2
<= is lower or equal to 3<=5
>= is greater or equal to 9>=2

When using comparison operators the result of a comparison is either true or false. For instance:

  • 3 < 5 returns true,
  • 3 > 5 returns false.

It is also possible to combine comparisons together using boolean operators such as and and or. This enables to check if more than one comparison are true (and operator) or whether at least one of the comparisons is true (or operator). e.g.

  • (3 < 5) and (3 < 7) returns true,
  • (3 == 5) or (3 < 9) returns true,
  • (3 == 5) and (3 < 9) returns false.

Starter Activity

Click on the picture below to check your knowledge of computing operators:


Rio the talkative parrot

Rio the parrot gets very talkative if:

  • It is early in the morning (between 5am and 10am).
  • It is sunny outside.

Complete the code below to tell the zoo keeper whether Rio will be quiet or noisy.


Gloria’s the Hippopotamus

When it is hot outside (above 24 Celsius degrees), Gloria the Hippopotamus loves sunbathing for 1 hour (=60 minutes) before having a mud bath to cool down.

Complete the code below to tell the zoo keeper where he can expect to find Gloria: either sunbathing outside on the grass or having a bath in the muddy puddle.


Leo the sleepy lion!

Did you know that a Lion sleeps on average 18 hours a day! Once Leo is awake he gets very hungry.
Complete the program bellow to tell the Zoo keeper if Leo will be asleep, hungry or happy!

Leo will be:

  • Sleepy if his sleeping time has not reached 18 hours
  • Hungry if his sleeping time is over 18 hours and he has not been fed.
  • Happy if his sleeping time is over 18 hours and he has been fed.


Penguins’ sunbathing time

During the summer the penguins love to go for a swim when the water temperature in the pool is at least two degrees cooler than the outside temperature.

Complete the code below to tell the zoo keeper where he can expect to find the penguins: either sunbathing outside or swimming in the pool.

Did you like this challenge?

Click on a star to rate it!

Average rating 3.3 / 5. Vote count: 40

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: