Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Having trouble with my code Python3 The output should be like this but I keep getting errors on every elif statement. Input: 4 dog medium

Having trouble with my code Python3

The output should be like this but I keep getting errors on every elif statement.

Input: 4 dog medium

Output:

How old is your pet?

What type of animal is your pet?

What size of dog do you have?

Your Medium Dog is 4 year(s) old.

That is 39 in human years.

When I just make them if statements it runs but it doesn't output what I want.

# Enter solution here age = int(input("How old is your pet?")) type= input(" What type of animal is your pet?") print() 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() 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.") if (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.")

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

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions