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 get_area 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 get_volume 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 10, call get_area, and display the area.
Have your code create a Pyramid with a length, width, and height of 10, call get_volume, 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!