2nd Semester Intro to Computer Science

Do Now 7.04

In your Console

Type the following


class Pet(object):
  def __init__(self, name):
  self.name = name
  def make_noise(self):
  print("Noise!")
  return

class Dog(Pet)

# A specific type of Pet!

dog1 = Dog()
dog1.make_noise()

In your Notebook

Respond to the following

  1. What is the output when you run this code?
  2. Rewrite the code to resolve the error and make this work properly
  3. What happens when you call method make_noise?

Edit this page Report an issue