Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python you will create a simple class pet which will contain: Type of pet (a string) Name of pet(a string) Age of pet (an

Using Python you will create a simple class pet which will contain:

  • Type of pet (a string)
  • Name of pet(a string)
  • Age of pet (an int)
  • Tricks (a list of tricks the pet can perform)
  • Fleas of pet (an int)

All of these data attributes except for the last one (fleas) will be unique to each object.

The fleas will be common to all pets, as they like to travel.

In your main part of your program, you will create 3 pets with various attributes (type, name, age) which you can pick. Each pet can perform at least 2 tricks and a random number of fleas between 0 and 10. They can add new tricks to their arsenal.

You will print the information for each of the pet, and the total number of fleas the households pets own.

Requirements:

  • You will have three or more methods in your class (including the constructor), one of which will return a value
  • You will use the random library

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

More Books

Students also viewed these Databases questions

Question

Compare the different types of employee separation actions.

Answered: 1 week ago

Question

Assess alternative dispute resolution methods.

Answered: 1 week ago

Question

Distinguish between intrinsic and extrinsic rewards.

Answered: 1 week ago