Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Where should I put the cat(age) and dog(age) function calls? Create a Python program (catdogage.py) that reads a pet's type (dog or cat) and age.

imageimage

Where should I put the cat(age) and dog(age) function calls?

Create a Python program (catdogage.py) that reads a pet's type (dog or cat) and age. Display the pet's type, along with their age in human years. The rules for this conversion are as follows: Dogs: 11 years per year for the first 2 years, then 4 years per extra year Cats: 15 years for first year, 10 years for second year, then 4 years per extra year Ensure that your program works correctly for integer ages. In your program, you must use functions to get a full credit. You need two functions: dog (age) and cat (age). Both functions have one parameter (age). The functions must return the converted age (No need for print statements inside the functions). You will complete this program in several steps. For each of the following steps, end the program's output with a newline. (1) Prompt the user to input the pet's type and age, then display them in one line. (Submit for 1 point) Is your pet a dog or a cat? dog What is the age of your pet? 3 You entered a dog that is 3 year(s) old (2) Calculate and print the age in human years. To do this part, you need to define the function dog (or the function cat if pet type was cat) then call it. final output should look like the following: (Submit -9 points, total 10) Is your pet a dog or a cat? dog What is the age of your pet? 3 You entered a dog that is 3 year(s) old The age of your dog in human years is 26

Step by Step Solution

3.41 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

We know that the return statement simply returns the values as ou... 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

Step: 3

blur-text-image

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

C++ Primer Plus

Authors: Stephen Prata

6th Edition

978-0321776402, 0321776402

More Books

Students also viewed these Programming questions