Created
April 29, 2019 00:13
-
-
Save chicagowebmanagement/d012f31a9a4a04c01d4eb23a2b8336be to your computer and use it in GitHub Desktop.
create a class triangle and return its area
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
""" | |
Author: Patrick Elward | |
Date: 04/28/2019 | |
Create a Triangle class with a method called area that calculates and returns its area. | |
Then create a Triangle object, call area on it, and print the result. | |
""" | |
import math | |
class Triangle: | |
def __init__(self,h,b): | |
self.height=h | |
self.base=b | |
self.a= (b*0.5)*h | |
area=Triangle(6,4) | |
print(area.a) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment