human
Give me a code to program to find area of a triangle and the other steps required given the following:
Program to find area of a triangle | ( X [ i ] , Y [ i ] ) are coordinates of i 'th point..
Initialize area.
Calculate value of shoelace formula.
Return absolute value.
Driver program to test above function"
How can the above be solved in Python?
assistant
#Here is code to program to find area of a triangle and the other steps required.
 def polygonArea ( X , Y , n ) :
	area = 0.0
	j = n - 1
	for i in range ( 0 , n ) :
		area = area + ( X [ j ] + X [ i ] ) * ( Y [ j ] - Y [ i ] )
	return abs ( area // 2.0 )
X = [ 0 , 2 , 4 ]
Y = [ 1 , 3 , 7 ]
n = len ( X )
print ( polygonArea ( X , Y , n ) )