Created
April 7, 2017 01:39
-
-
Save IanCarloz/54305aaaa4ea1ae3b222669f7bbf3410 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Figura: | |
def __init__(self, name, height, width): | |
self.name = name | |
self.height = height | |
self.width = width | |
def area(self): | |
area = self.height * self.width | |
print('a=', area) | |
def perimetro(self): | |
perimetro = self.height * 2 + self.width * 2 | |
print('p=', perimetro) | |
if __name__ == '__main__': | |
cuadrado = Figura("Cuadrado", 5, 5) | |
print(cuadrado.name, cuadrado.height, cuadrado.width) | |
print('-',cuadrado.area()) | |
print('-',cuadrado.perimetro()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment