With reference to the answer to question 17 in chapter 3. I got the impression that the value of the variable animals ended up 3 because the loop used is a do/while loop (see attached image). This variable would have had the same result if a while loop was used instead.
While technically correct (that the body of the do/while loop is always executes at least once), do you think that the answer should emphasis the point that the body of the loop has nothing to do with the outcome?
I didn't understand your reply and the following may be based on my wrong understanding.
Am I correct to understand that if the do/while loop in this example is switch to a while loop, we would have a different result?
While it is correct that the body of the do/while is always executed once, this does not play any role in the question's outcome, as the variable animals is incremented within the loop's condition check. Switching the loop to a while loop will produce the same output.
do/while loop (original, as shown in the book)
Both examples yield the same output as the animals variable is incremented within the loop's condition check, which is always executed. The difference in this case is that in the do/while loop, the condition is evaluated after the loop's body is executed and in the case of the while loop, the condition is executed before the loop's body. Both examples yield the same output.
Because of this, I would emphasis that the do/while body loop has nothing to do with the output, and the while loop would have produced the same result.