Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- ERRORS
- A. print(Triangle.mytriangle_area(self)) = NameError: name 'self' is not defined
- B. print(Triangle.mytriangle_area()) = TypeError: mytriangle_area() missing 1 required positional argument: 'self' (SEE LINE with comments BELOW)
- C. print(Triangle.mytriangle_area) = prints out '<function Triangle.mytriangle_area at 0x7f8f1a5fb620>'
- """
- # ----------------------------------------------
- import math
- class Triangle:
- def __init__(self, base, height):
- self.base = base
- self.height = height
- def triangle_area(self):
- return (self.base/2)*self.height
- goofy = Triangle(23.5, 35.4)
- print(goofy.triangle_area())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement