Question: Create two classes, a Triangle class, and a Pyramid class. The Triangle class needs two self variables ( instance variables ) - height and base.
Create two classes, a Triangle class, and a Pyramid class.
The Triangle class needs two "self" variables instance variables height and base.
The Triangle class needs a getarea method that will return the area of the triangle.
The Pyramid class needs three instance variables length, width, and height.
The Pyramid class needs a getvolume method that will return the volume of the pyramid.
The formulas are easy to google, but if you need help with them, text me
Have your code create a Triangle with a height and base of call getarea, and display the area.
Have your code create a Pyramid with a length, width, and height of call getvolume, and display the volume.
Add a str method to each class if you don't use the @dataclass decorator.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
