Question
Create a class called triangle area. The initializing inputs are numbers b and h. In addition to the initialization method, the class must have the area method, which calculates the area of ​​a triangle (A = bx h / 2) and creates an attribute called Area with that value.
(30 puntos) Crea una clase llamada triangle_area. Los insumos inicializadores son los números b y h. Además del método inicia

answer in python language
0 0
Add a comment Improve this question Transcribed image text
Answer #1

main.py 1. class Triangle_Area: def __init__(self,b,h): self.b=float(b) self.h=float(h) covouw def area(self): S=(self.b*self

Code for copying

class Triangle_Area:
    def __init__(self,b,h):
        self.b=float(b)
        self.h=float(h)
      
    def area(self):
        s=(self.b*self.h)/2
        return s
b=input("Enter the value of breadth : ")
h=input("Enter the value of height : ")
t=Triangle_Area(b,h)
print("area : {}".format(t.area()))

Add a comment
Know the answer?
Add Answer to:
Create a class called triangle area. The initializing inputs are numbers b and h. In addition...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT