Skip to content

Commit d134f52

Browse files
committed
updating for homework
1 parent 8207a10 commit d134f52

File tree

129 files changed

+93804
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+93804
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
simple oo example
3+
"""
4+
5+
class Pet:
6+
""" This class defines Pet, which is an animal kept by a human for domestic purposes" """
7+
def __init__(self, name):
8+
self.name = name
9+
self.hello = "None"
10+
11+
def speak(self):
12+
""" sample - maybe lots of code in this """
13+
return self.hello
14+
15+
def swim(self):
16+
return "splash"
17+
18+
mypet = Pet("Goldie") # i am an object: an instance of the class Pet
19+
20+
print(mypet.name)
21+
print(mypet.speak())
22+
print(mypet.swim())
23+
import sphinx
24+
import pytest
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""
2+
simple oo example
3+
"""
4+
5+
6+
class Pet:
7+
def __init__(self, name):
8+
self.name = name
9+
self.hello = None
10+
11+
def speak(self):
12+
""" sample - maybe lots of code in this """
13+
return self.hello
14+
15+
16+
class Dog(Pet):
17+
def __init__(self, name, license_num):
18+
Pet.__init__(self, name)
19+
self.hello = "woof"
20+
21+
# i can specialize and add to subclass
22+
self.license_num = license_num
23+
24+
def speak(self):
25+
""" reuse or embelish code from superclass """
26+
return Pet.speak(self)
27+
28+
29+
mypet = Pet("Goldie")
30+
print(mypet.name)
31+
print(mypet.speak())
32+
33+
mypet = Dog("Bogart", "AB56674")
34+
print(mypet.name)
35+
36+
# i just tell it to speak
37+
print(mypet.speak())
38+
39+
print(mypet.license_num)

students/Justin_Jameson/lesson01/activity/.idea/activity.iml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

students/Justin_Jameson/lesson01/activity/.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

students/Justin_Jameson/lesson01/activity/.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

students/Justin_Jameson/lesson01/activity/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)