Vertex AI의 최신 멀티모달 모델인 Gemini 1.5 모델을 사용해 보고 100만 개의 토큰 컨텍스트 윈도우로 빌드할 수 있는 항목을 확인해 보세요.Vertex AI의 최신 멀티모달 모델인 Gemini 1.5 모델을 사용해 보고 100만 개의 토큰 컨텍스트 윈도우로 빌드할 수 있는 항목을 확인해 보세요.
from collections import namedtuple
from math import sqrt
# A point has an x and a y coordinate
Point = namedtuple('Point', 'x y')
# A triangle is defined by three points
Triangle = namedtuple('Triangle', 'a b c')
def distance(p, q):
"""Returns the distance between the provided pair of points"""
return sqrt((p.x - q.x)**2 + (p.y - q.y)**2)
def perimeter(triangle):
"""Returns the perimeter of the provided triangle"""
return distance(triangle.a, triangle.b) + distance(triangle.b, triangle.c) + distance(triangle.c, triangle.a)
def area(triangle):
"""Returns the area of the provided triangle using Heron's formula"""
docstring에 따라 영역 함수 본문을 작성합니다.
응답
from collections import namedtuple
from math import sqrt
# A point has an x and a y coordinate
Point = namedtuple('Point', 'x y')
# A triangle is defined by three points
Triangle = namedtuple('Triangle', 'a b c')
def distance(p, q):
"""Returns the distance between the provided pair of points"""
return sqrt((p.x - q.x)**2 + (p.y - q.y)**2)
def perimeter(triangle):
"""Returns the perimeter of the provided triangle"""
return distance(triangle.a, triangle.b) + distance(triangle.b, triangle.c) + distance(triangle.c, triangle.a)
def area(triangle):
"""Returns the area of the provided triangle using Heron's formula"""
s = perimeter(triangle) / 2
return sqrt(s * (s - distance(triangle.a, triangle.b)) * (s - distance(triangle.b, triangle.c)) * (s - distance(triangle.c, triangle.a)))