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]
2 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]2 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
If an engine has four cylinders and a total of 16 valves, how many valves would each cylinder have?
wel
4 because 4 x 4=16. Easy. I like to think of it as multiplication.
4 0
3 years ago
The node of a doubly linked list contains _____.
meriva

Answer:

Hi!

The correct answer is one data field and two links fields.

Explanation:

The node of a doubly-linked list contains one data field, and two links fields that references to the next node on the list and another one link field that references to the previous node in the sequence of nodes).

3 0
3 years ago
ILL GIVE BRAINLIEST You are taking a photograph of a valley and want to draw attention to a hamlet hidden amid the hills. Which
lana [24]
Answer: A
Explanation: Because it’s close to the hamlet but not blocking it like option B or drawing attention away from it like option C or D
Hope this helps!
7 0
3 years ago
Read 2 more answers
The carbon fixation reaction converts?​
Ainat [17]

Answer:

Photosynthetic carbon fixation converts light energy into chemical energy. Photosynthesis reduces the carbon in carbon dioxide from OSC = +4 to OSC = +1 in the terminal carbon in glyceraldehyde-3-phosphate, the feedstock for simple sugars, amino acids, and lipids.

3 0
3 years ago
How many different bit strings are there of length 8 that contain the string 0000?
Nataly_w [17]

Answer:

answer is 8! / (4! * 4!). Which gives a value of 70.

Explanation:

we have 8 places, we’re going to pick 4 places to put the zeros, it is 8! / (4! x 4!)

3 0
2 years ago
Other questions:
  • What are the first two lines of defense a company should take when addressing security risks?
    10·1 answer
  • True or false: when an ospf route sends its link state information, it is sent only to those nodes directly attached neighbors.
    14·1 answer
  • When powering up a home network, make sure all computers and peripherals are turned on before turning on the modem/router?
    11·1 answer
  • Which statement describes the relationship between science and technology?
    13·2 answers
  • Rapunzel s-a născut într-un ţinut îndepărtat într-un regat necunoscut. Mama vitregă a închis-o pe Rapunzel într-un turn foarte î
    6·1 answer
  • Today, scientists agree that good research is ethical in nature and is guided by basic respect for human dignity and safety. How
    6·1 answer
  • Direction: using the data at the left, answer the questions that follows.​
    11·1 answer
  • Package Newton’s method for approximating square roots (Case Study: Approximating Square Roots) in a function named newton. This
    14·1 answer
  • What is a computer modem?​
    9·1 answer
  • How does 5G technology enhance the Internet of Things (ioT) ?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!