Skip to content

Commit 214fe96

Browse files
authored
Create rectangle_area.py
1 parent fc871f0 commit 214fe96

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

rectangle_area.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# coding: utf-8
2+
3+
class Rectangle:
4+
5+
'''
6+
* Define a constructor which expects two parameters width and height here.
7+
'''
8+
# write your code here
9+
10+
'''
11+
* Define a public method `getArea` which can calculate the area of the
12+
* rectangle and return.
13+
'''
14+
# write your code here
15+
def __init__(self, width, height):
16+
self.width = width
17+
self.height = height
18+
19+
def getArea(self):
20+
return self.width * self.height
21+
22+
# naive: http://lintcode.com/zh-cn/problem/rectangle-area/

0 commit comments

Comments
 (0)