00:03
Okay, this time they want us to, let's see, compute the area of a triangle, only from, let's see, the vertices of the triangle.
00:19
So we're going to get there's three coordinates, so we'll get three -step program.
00:27
In order to calculate the area, and then display it to the user.
00:33
We're first going to need a prompt for the points for the vertices as coordinates.
00:42
Okay, let's see.
00:45
They give us a sample.
00:48
Click i want us to do it in one line.
00:52
Let's see.
00:53
X1, y one can be the coordinate for the first vertices, x1, y2, coordinate for the second vertices, x3yc, coordinate for the third, let's see, vertices.
01:08
And specifically, first evaluate these to be numbers.
01:13
We're specifically going to ask according to the prompt, the user in the manner, enter, three points for a triangle and it looks like the user is going to have to know that they're just going to answer each individual coordinate starting from the first point to the last separated by commons so let's answer six numbers with comments we're going to calculate the area looks like we're going to use haron's formula that's sides will be the easiest to get we're going to get our s so we're going to add the side links together side length 2 plus side length 3 divide that by 2 and then our area will be equal to that number let's see square root so we'll just take that to the 0 .5 power of the s and then s subtract side 1 and multiply that by the s subtract side side and you multiply that by the s subtract side 3 let's see so arrange to compute sides 1 2 and reverse aren't we how do we compute the length of the side? we should compute the distance between two points.
02:44
So then one.
02:45
The distance is going to be a square root of the difference of their x -coordinates squared.
02:53
And it's this.
02:56
Let's see.
02:57
X1 minus x2.
03:00
And then their y coordinates are 1 minus y2 squared.
03:04
That's the distance between the first vertices and the second.
03:09
It's the length of that side.
03:13
Let's see.
03:17
We'll get our second and third side in a similar way.
03:23
So this will be between the second vertex and the third vertex.
03:32
And this will be from the third vertex and the first vertex.
03:40
We sort of wrote our formula in the comment in python code, which is nice because we can just now copy and paste it.
03:51
Let's see.
03:54
That looks good.
03:54
And now i should display that to the user.
03:58
I need to print.
03:59
What message do they display in the sample? the area of the triangle is.
04:06
And they just give the area that they computed.
04:10
Let's enter the same three points that they did...