Where should I put the cat(age) and dog(age) function calls? Create a Python program (catdogage.py) that reads
Fantastic news! We've Found the answer you've been seeking!
Question:
Where should I put the cat(age) and dog(age) function calls?
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
We know that the return statement simply returns the values as ou... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The demand function of dog breeders for electric dog polishers is qb = max {200p, 0}, and the demand function of pet owners for electric dog polishers is qo = max {90 4p, 0}. (a) At price p, what is...
-
I am at a dog training class. Twenty percent of the dogs are hounds. The other eighty percent of the dogs are of the toy variety. Ninety percent of the hounds are stubborn and difficult to train....
-
The America Dog and Cat Hotel is a pet hotel located in Las Vegas. Assume that in March, when dog-days (occupancy) were at an annual low of 500, the average cost per dog-day was $21. In July, when...
-
North Folk Dairy has an unused bank revolving credit of $50 million. North Folk Dairys vendor provided an invoice in the amount of $100,000 with payment terms of 2/10, net 45. Compute the nominal...
-
Outline the basic process for human resource planning.
-
Sale of Equipment was acquired at the beginning of the year at a cost of $ 4 0 , 2 5 0 . The equipment was depreciated using the double - declining - balance method based on an estimated useful life...
-
Prove directly that, for each \(t \geq 0\), \[\mathbb{E}\left(e^{-z T(t)} ight)=\int_{0}^{\infty} e^{-z s} f_{T(t)}(s) d s=e^{-t z^{1 / 2}}\] where \((T(t), t \geq 0)\) is the Lvy subordinator.
-
(Fill in the blanks) 1. The FASB publishes its Accounting Standards Codification (ASC) as the source of accounting and reporting guidance for _______ hospitals. 2. FASB standards _______ (lways,...
-
What is the total cash collection for April? Q1- the following is information of Royal Company for the quarter ending June 30th Sales budgets for the next four months are: April May June Budget sales...
-
Kinshasa Camera Shop uses the lower-of-cost-or-market basis for its inventory. The following data are available at December 31. Instructions Determine the amount of the ending inventory by applying...
-
You have a client with $40,000 of capital losses. Which statements are true? Check all that apply a. Capital loss carryovers can be carried over indefinitely until they are all used. b. $3,000 of the...
-
You own the following portfolio, which is a significant part of your wealth: Face Coupon paid Market Value Value Security US Treasury Bill Corporate Bond Rated Aa Corporate Bond rated B Corporate...
-
For 0 = 0 to = 360 with step of 10, draw the following signals either using 'Octave' any other software, for A = 10. Y1 = A Sin(0)= 10 Sin (0), Y2 = 10 Sin(0 + ), take = 90 Y3 = 10 Cos(0) Y4 = 10...
-
Determine the shear and moment in the beam as a function of x. (20pts.) SkN/m 2.5m - 3m
-
Write equations that show how to use the distributive property ("each with each" or "FOIL") to find the product 3x2 4. Your equations need to: correctly demonstrate the distributive property or FOIL...
-
Evaluate the following definite integral using the method of Example 10.2 (page 67): 90 0 x +1 dx for a real with a > 0. Hint: Since the integrand is an even function of x you may use * cos(ax) dx...
-
Does GM have a contingent liability for its 2015-2019 Chevrolet Corvettes? Recently, a class action lawsuit was filed against General Motors (GM) accuses GM of using inferior materials and a faulty...
-
Willingness to pay as a measure of a person's value for a particular good measures the maximum a person would be willing to pay requires that payment actually be made depends on the satisfaction that...
-
Suppose we have the following structure declaration: struct applicant { char name[30]; int credit_ratings[3]; }; a. Write a function that takes an applicant structure as an argument and displays its...
-
Write a template function max5() that takes as its argument an array of five items of type T and returns the largest item in the array. (Because the size is fixed, it can be hard-coded into the loop...
-
Consider the Grand, Superb, and Magnificent classes defined in this chapter. Suppose pg is a type Grand * pointer that is assigned the address of an object of one of these three classes and that ps...
-
Assume the same facts as in Problem 42. Further assume that next year, Gary sells the SUV for $20,000. a. How much depreciation expense can Gary deduct as a business deduction with respect to the SUV...
-
Describe how liabilities are reported and analyzed.
-
Assume the same facts as in Problem 29, except that Sally has AGI of \($75,000.\) What is her qualified student loan interest deduction in 2019? Problem 29, In 2019, Sally Morris, a single taxpayer,...
Study smarter with the SolutionInn App