Given the coordinates of three points A(x1, y1), B(x2, y2), and C(x3, y3), find the area of the triangle ABC. Which of the following code snippets is correct?
What is the output of the following code snippet?
import math
def distance(x1, y1, x2, y2):
return math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
print(distance(1, 2, 4, 6))
Given the equation of a circle and the coordinates of a point, how can you determine if the point lies inside the circle?
What is the output of the following code snippet?
def square(x):
return x**2
def cube(x):
return x**3
print(square(cube(2)))
Which of the following code snippets can be used to determine if two line segments intersect?
Which of the following code snippets can be used to find the length of the union of two line segments?
Given two circles with centers (x1, y1) and (x2, y2) and radii r1 and r2, what is the maximum number of common tangents they can have?
What is the output of the following code snippet?
def circle_intersection(x1, y1, r1, x2, y2, r2):
d = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
if d > r1 + r2:
return "No intersection"
elif d < abs(r1 - r2):
return "One circle is completely inside the other"
else:
return "Intersection exists"
print(circle_intersection(0, 0, 5, 8, 0, 3))
Which of the following code snippets can be used to check if a line intersects a circle?