美文网首页
454. Rectangle Area

454. Rectangle Area

作者: fdgump | 来源:发表于2018-01-11 11:40 被阅读0次

[ http://www.lintcode.com/en/problem/rectangle-area/ ]

# Python
class Rectangle:

    '''
     * Define a constructor which expects two parameters width and height here.
    '''
    # write your code here
    def __init__(self, width, height):
        self.width = width
        self.height = height
    
    '''
     * Define a public method `getArea` which can calculate the area of the
     * rectangle and return.
    '''
    # write your code here
    def getArea(self):
        return self.width * self.height

相关文章

网友评论

      本文标题:454. Rectangle Area

      本文链接:https://www.haomeiwen.com/subject/xtpznxtx.html