Skip to content

Commit 623f88d

Browse files
put in some code samples, bulk of presentation.
1 parent 13cec07 commit 623f88d

File tree

6 files changed

+548
-35
lines changed

6 files changed

+548
-35
lines changed

week-08/code/circle_solution.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
circle class -- my solution to the exercise
5+
6+
test code to run it is in test_circle.py
7+
"""
8+
9+
import math
10+
11+
class Circle(object):
12+
def __init__(self, radius):
13+
self.radius = radius
14+
15+
def get_area(self):
16+
return self.radius**2 * math.pi
17+
18+
def __add__(self, other):
19+
return Circle(self.radius + other.radius)
20+
21+
def __repr__(self):
22+
return "Circle(%f)"%self.radius
23+
24+
def __str__(self):
25+
return "Circle Object with radius: %f"%self.radius
26+

week-08/presentation-week-08.pdf

77.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)