Python3 (2) Output the human years for the animal. Human years for a cat is thei
ID: 3743988 • Letter: P
Question
Python3
(2) Output the human years for the animal. Human years for a cat is their age multiplied by 4 plus 15. If the cat is a year old then their human equivalent is 19 years. If they are 5 years old then they are 35 in human years. (3 pts)
Ex:
(3) If the type of animal is a Dog, then have ask the user for the size of the dog. (2 pts)
(4) Calculate the human age for the different dog sizes (6 pts) The human age for a Small dog is 4 times the age plus 20 The human age for a Medium dog is 6 times the age plus 15 The human age for a Large dog is 9 times the age plus 4
Ex:
Ex2:
(5) If they don't enter cat or dog warn the user (1 pt)
(6) If they don't enter a valid size for a dog. Warn the user (1 pt)
Explanation / Answer
//up to 3 part question
age = int(input("How old is your pet? "))
type= input("What type of animal is your pet? ")
if type == "cat" or type == "dog" :
print ("Your Cat is ",age,"year(s) old.")
print("That is ",(age*4+15), "in human years.")
elif type == "Dog" or type == "dog" :
size = input("What size of dog do you have? ")
print ("Your dog is ",age,"year(s) old.")
else :
print ("I'm sorry I don't know what a ",type," Dog is.")
-----------------------------------------------------------------------------
//output
How old is your pet? 5
What type of animal is your pet? Dog
What size of dog do you have? small
Your dog is 5 year(s) old.
-----------------------------------------------------------
//4,5,6 QS
age = int(input("How old is your pet? "))
type= input("What type of animal is your pet? ")
if type == "cat" or type == "Cat" :
print ("Your Cat is ",age,"year(s) old.")
print("That is ",(age*4+15), "in human years.")
elif type == "Dog" or type == "dog" :
size = input("What size of dog do you have? ")
print ("Your dog is ",age,"year(s) old.")
if size == "Small" or size == "small" :
print("Your ",size," Dog is ",age,"year(s) old.")
print("That is ",(age*4+20)," in human years.")
if size == "Medium" or size =="medium":
print("Your ",size," Dog is ",age,"year(s) old.")
print("That is ",(age*6+15)," in human years.")
elif size == "Large" or size == "large":
print("Your ",size," Dog is ",age,"year(s) old.")
print("That is ",(age*9+4)," in human years.")
else :
print ("I'm sorry I don't know what a ",type," Dog is.")
-------------------------------
//output1
How old is your pet? 5
What type of animal is your pet? Dog
What size of dog do you have? Small
Your dog is 5 year(s) old.
Your Small Dog is 5 year(s) old.
That is 40 in human years.
//output2
How old is your pet? 5
What type of animal is your pet? Dog
What size of dog do you have? Medium
Your dog is 5 year(s) old.
Your Medium Dog is 5 year(s) old.
That is 45 in human years.
//output3
How old is your pet? 5
What type of animal is your pet? Dog
What size of dog do you have? Large
Your dog is 5 year(s) old.
Your Large Dog is 5 year(s) old.
That is 49 in human years.
//output 4
How old is your pet? 5
What type of animal is your pet? Turtle
I'm sorry I don't know what a Turtle Dog is.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.