Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 456 Bytes

File metadata and controls

22 lines (15 loc) · 456 Bytes

Do Now 7.02

In your Console

Type the following

class Pet:
  def __init__(self, name):
    self.name = name

my_pet = Pet('Peter')
print(my_pet.name)

In your Notebook

Respond to the following

  1. What is the purpose of the __init__ method?
  2. What if you wanted to initialize all pet objects with a name and a color?
  3. How would you modify the code to create a pet object with a name of "Peter" and a color of "brown"?