fork download
  1. #삼각형 만들기
  2. class Triangle:
  3. base = 0
  4. height = 0
  5.  
  6. def set_length(self,a,b):
  7. a = int(a)
  8. b = int(b)
  9. self.base = a
  10. self.height = b
  11.  
  12.  
  13.  
  14. def print_area(self):
  15. return print(self.base*self.height/2)
  16.  
  17. class RATriangle(Triangle):
  18. def print_hypotenuse(self):
  19. return print((self.base**2+self.height**2)**0.5)
  20.  
  21.  
  22. cha = RATriangle()
  23. cha.set_length(5,7)
  24. cha.print_area()
  25. cha.print_hypotenuse()
Success #stdin #stdout 0.02s 9288KB
stdin
Standard input is empty
stdout
17.5
8.602325267042627