Question: 2 9 . 3 ) Animal Rater Create a function named rate _ animal that will rate the value of different animals on a numeric

29.3) Animal Rater
Create a function named rate_animal that will rate the value of different
animals on a numeric scale (1-4, where 1 is best and 4 is worst). Your function
should consume a variable named animal that represents the type of animal as a
string, and return an integer from 1-4 for each of four respective inputs:
"dog", "cat", "capybara", and "danger noodle". Each animal should have
its own value. If the string given is not one of these animals, return -1.
Use your function to print out the rating for your favorite animal. You should
consider writing unit tests, but you are not required to do so.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!