@hopebrooke/

OOPS-woof

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class Dog():
  def __init__(self,myname,mycolour):
    self.name = myname
    self.colour = mycolour
    
  def bark(self, barktimes):
    for i in range(barktimes):
      print("woof")
      
  def setname(self, myname):
    self.name = myname

  def getname(self):
    return self.name
  
  def setcolour(self,mycolour):
    self.colour = mycolour

  def getcolour(self):
    return self.colour

  def printDogdetails():
    print(self.name,self.colour)

myDog1 = Dog("pickle", "brown")
myDog2 = Dog("elsie", "black")

myDog2.bark(10)

myDog1.printDogDetails()
myDog1.setcolour("white")
myDog1.printDogDetails()