Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BlockPy: # 27.3) Animal Rater Create a function named rate_animal that will rate the value of animals on a numeric scale (1-4, where 1

image

BlockPy: # 27.3) Animal Rater Create a function named rate_animal that will rate the value of animals on a numeric scale (1-4, where 1 is best and 4 is worst). Your function should consume a variable (holding a string value) named an_animal and return an integer from 1-4 for each of four possible inputs: "dog", "cat", "capybara", and "danger noodle". Each animal should have its own value. If the string given is not a valid animal from the list, return -1. Unit test the result, but also use your function to print out your favorite animal's rating. This should be the animal that produces the value 1. Console: X * Feedback: Incorrect Answer Must Return in Function The function main is not returning. However, that function is supposed to have a return statement. O View Trace

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Microeconomics

Authors: Hal R. Varian

9th edition

978-0393123975, 393123979, 393123960, 978-0393919677, 393919676, 978-0393123968

More Books

Students also viewed these Programming questions