Python(프로그래머스)/스택,큐
★스택★이중리스트_직사각형 좌표구하기[프로그래머스]
goAhEAd_29
2023. 6. 23. 16:07
728x90
반응형
def find_missing_point(points):
x_coords = []
y_coords = []
for point in points:
x_coords.append(point[0])
y_coords.append(point[1])
missing_x = 0
missing_y = 0
for x in x_coords:
if x_coords.count(x) == 1:
missing_x = x
for y in y_coords:
if y_coords.count(y) == 1:
missing_y = y
return missing_x, missing_y
# 3개의 좌표
points = [(1, 1), (1, 3), (3, 1)]
# 나머지 한 점의 좌표 계산
missing_point = find_missing_point(points)
print("나머지 한 점의 좌표:", missing_point)
728x90
반응형