``` class Triangle: pass triangle1=Triangle() triangle1.height=10 triangle1.base=12 print(1/2*triangle1.height*triangle1.base) ``` The output was as follows when I run this program:  I declare a class named Triangle. Then I created an instance of that class which is triangle1. triangle1 is also the object of the class Triangle. Then I set the attribute of that object triangl1 which as height and base and then finally printing the value by using the formula of area of triangle. You can run this program online [here](https://www.onlinegdb.com/online_python_compiler), just copy paste the code.
author | leoumesh |
---|---|
permlink | simple-python-class-example-to-caluclate-the-area-of-triangle |
category | coding |
json_metadata | {"tags":["coding","programming","python","study","language"],"image":["https://cdn.steemitimages.com/DQmPzv6LJ2Ue5dAjU5uCaJe9dk981zNdfuPzfnUacTkDezj/Screenshot_2.png"],"links":["https://www.onlinegdb.com/online_python_compiler"],"app":"steemit/0.2","format":"markdown"} |
created | 2020-03-10 14:09:45 |
last_update | 2020-03-10 14:09:45 |
depth | 0 |
children | 0 |
last_payout | 2020-03-17 14:09:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 1.407 HBD |
curator_payout_value | 1.400 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 724 |
author_reputation | 212,340,493,251,438 |
root_title | "SIMPLE PYTHON CLASS EXAMPLE TO CALUCLATE THE AREA OF TRIANGLE" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 96,235,388 |
net_rshares | 11,867,608,855,700 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
steemcleaners | 0 | 11,410,934,487,641 | 20% | ||
tunnelrat | 0 | 23,613,467,257 | 100% | ||
asok | 0 | 628,903,731 | 100% | ||
mnine3 | 0 | 91,182,402 | 100% | ||
sattpaing | 0 | 78,930,430 | 100% | ||
ganastha | 0 | 708,648,230 | 100% | ||
leoumesh | 0 | 51,844,341,744 | 100% | ||
anonek | 0 | 649,050,075 | 100% | ||
boaungdean | 0 | 434,500,303 | 100% | ||
sanketa | 0 | 486,901,314 | 100% | ||
pyaethein1989 | 0 | 380,621,929 | 100% | ||
goldbloger4 | 0 | 533,131,023 | 100% | ||
mgking1 | 0 | 403,685,384 | 100% | ||
gold-bloger1 | 0 | 522,728,695 | 100% | ||
zuerich | 0 | 372,344,625,827 | 20% | ||
myatminaye | 0 | 513,117,196 | 100% | ||
myinttheinkhaing | 0 | 512,952,110 | 100% | ||
deepakgurau | 0 | 559,744,546 | 100% | ||
farelsteem | 0 | 528,537,619 | 100% | ||
a-x | 0 | 440,154,780 | 100% | ||
nullnull | 0 | 360,698,004 | 100% | ||
savetheday | 0 | 467,658,870 | 100% | ||
bhatta | 0 | 570,786,590 | 100% |