Question: What you see below is called a decision tree. It can be used to guess an animal-based on questions about the properties of that animal.
What you see below is called a decision tree. It can be used to guess an animal-based on questions about the properties of that animal. Each "yes" or "no" answer narrows down the possibilities until you reach the leaves of the decision tree, after which one of eight animals are implicated.
Your task is to create a program ( python language ) that asks three questions and then prints out the animal, based on the answers. The first question will always be "Does it live in water?" The second question will depend on the answer to the first one---if the answer is "yes", it will be "Is it a mammal?", if no, it will be "Is it carnivorous?", and so forth. Once you reach the decision, you should print out "It's a X!" where X is the correct animal.
Here's an example of what your program should look like when it's running.
Does it live in water? yes Is it a mammal? no Is it edible? yes It's a fish!
The "yes", "no", "yes" words were entered by the user in the above sequence of questions and answers - everything else was produced by the program.
Lives in water? Yes Carnivorous? Mammal? No Yes Yes Gives Milk Appears on India's National Emblem? edible? Very large in size No Yes No Yes No No No Yes Bull. Cow Tiger Lion Sea Snake Fish Seals Whale
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
