Animal classification

‘What am I?’ is a simple classification game. The user must think of a type of pet and the computer will then ask a series of yes-or-no questions before it attempts to guess what the pet is.
For example, the computer might ask ‘Does the pet have legs?’. The response to the question causes the program to branch and ask further questions depending on whether the answer was ‘yes’ or ‘no’. For example, if the answer to ‘Does the pet have legs?’ is no, it makes no sense to ask ‘Does the pet have eight legs?’. The task is to write a program that can use the answer to a question to make a decision about what to do next.

The animals that you need to categorise are cat, dog, fish, snake, spider, hamster, parrot. Think of the questions that you could ask to separate them.

Scroll to Top