1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
k0ka [10]
3 years ago
11

Write a class definition line and a one line docstring for the class Dog. Write an __init__ method for the class Dog that gives

each dog its own name and breed. Test this on a successful creation of a Dog object. >>> import dog >>> sugar
Computers and Technology
1 answer:
Viefleur [7K]3 years ago
4 0
Python Code:

class Dog:
""" Dog class definition """

# data attribute species as part of the class Dog
species = "Canis familiaris"

def __init__(self, _name, _breed):
""" Constructor """
# Assigning values
self.name = _name
self.breed = _breed
self.tricks = []

def teach(self, trick):
""" add a passed string parameter to tricks """
# Adding to list
self.tricks.append(trick)
# Printing message
print(self.name + " knows " + trick)


def knows(self, chkStr):
""" check whether a passed string parameter is in the dog’s list of tricks """
# Checking in tricks list
if chkStr in self.tricks:
# Printing message
print("Yes, " + self.name + " knows " + chkStr)
else:
# Printing message
print("No, " + self.name + " doesn't know " + chkStr)
You might be interested in
Lol WAKE UP!!! and get ready to answer my questions.
deff fn [24]

Answer:

<h2>1. Variable Creation Statement</h2><h2>2. Fav_Num=7</h2>

Explanation:

<h2><em>Hope This Helps :)</em></h2><h2>Im not sure if the 2nd one is correct but i think that it is.</h2>
5 0
3 years ago
The person who suggested that the continents were once a supercontinent, called Pangaea, but slowly drifted apart was who
kherson [118]
Alfred Wegener was the one who came up with the Pangea.
3 0
3 years ago
Read 2 more answers
Why are large commercial companies interested in developing mobile apps for smartphones?
loris [4]
Because they can make a lot of money if they create a popular application.
7 0
3 years ago
Given the structure definition shown, assume that circle1 and circle2 are variables of the Circle type and their members have be
kolezko [41]

Answer:

False is the correct answer for the above question.

Explanation:

  • The structure is a user-defined data type, which is used to define the set of different data types and values. Just like in the above question, the class structure holds the list of three variables, which is a type of double.
  • When any user wants to compare the two structure values, then he can do it with the help of comparing all the variables of a structure. if a user wants to compare the circle1 with the value of the circle2, then he needs to compare the circle1.centerX with circle2.centerX, and so on with the other variables.
  • But the above question syntax will directly compare the two structure variable, which is not correct. Hence the above answer is false.
6 0
4 years ago
Which of the following characters is acceptable to use in a filename
Rama09 [41]
You never stated the possible answer choices to your answer, but usually in a filename you can use all letters of the alphabet, but you cannot use any symbols. such as backslashes, percentage signs etc., but underscores you can use, since they can be used for spacing 2 seperate words.
4 0
3 years ago
Read 2 more answers
Other questions:
  • A spreadsheet has some values entered: Cell A1 contains 10, cell A2 contains 14, cell A3 contains 7. You enter in cell A4 the fo
    6·1 answer
  • A(n) _ is a book of synonyms.
    14·1 answer
  • The ____ provides access to the Internet may also be internal.
    14·2 answers
  • Describe Format Painter by ordering the steps Jemima should follow to make the format of her subheadings more
    6·1 answer
  • What is wrong with the following declaration? How should it be fixed?
    11·1 answer
  • What are the four types of technical drawing?​
    9·1 answer
  • If you want to code a method that can only be called from the class that the method is in, you code ____________________ as the
    15·2 answers
  • Application servers are usually grouped into two types: page-based and _____ systems.
    6·1 answer
  • Use Python.
    7·1 answer
  • Which statement is true about hacking?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!