Question
Write a function (named triangle_area as in the example) that calculates the area of a triangle using 2D coordinates of corner points and returns only
Write a function (named triangle_area as in the example) that calculates the area of a triangle using 2D coordinates of corner points and returns only the calculated area. Do not call the function inside the script, only define it! Do not use input function in this function! BY USING Python 3 Write a function (named triangle_area as in the example) that calculates the area of a triangle using 2D coordinates of corner points and returns only the calculated area. Do not call the function inside the script, only define it! Do not use input function in this function!
def triangle_area(x1,y1,x2,y2,x3,y3): This function calculates the area of a triangle using 2D coordinates of corner points. parameters: Coordinates of 1st corner (x1,y1) Coordinates of 2nd corner (x2,y2) Coordinates of 3rd corner (x3,y3) return value: area ->area of the triangle return area Example Values (not displayed on screen): coordinates of 1st corner (1.5,-3.4) Coordinates of 2nd corner (4.6, 5.0) Coordinates of 3rd corner (9.5,-3.4) (calculated) Area33.6 Call example: triangle_area (1.5,-3.4,4.6,5.0,9.5,-3.4) areu - Vs(s - side1) (s - side2) (s -side3) s (side1 side2side3)/2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started