Skip to content

Commit f32ad40

Browse files
committed
1 parent e5575ba commit f32ad40

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Hongjoo/lv0/평행.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
(1)평행선 -> 같은 기울기
3+
(2) 두 직선이 일치하는 경우도
4+
"""
5+
6+
def solution(dots):
7+
# 모든 직선의 기울기 구하기
8+
# 1. 점 2개 선택
9+
# 2. 기울기
10+
answer = 0
11+
loops= []
12+
13+
for i in range(len(dots)) :
14+
for j in range(i+1, len(dots)) :
15+
x1 , y1 = dots[i]
16+
x2 , y2 = dots[j]
17+
print(f"### {x1} ,{y1} , {x2} , {y2}")
18+
output= (y1-y2)/(x1-x2+0.0001)
19+
loop = abs(output)
20+
print(f"##{loop}")
21+
for l in loops :
22+
if loop == l :
23+
return 1
24+
loops.append(loop)
25+
print("$" ,loops)
26+
27+
return answer

0 commit comments

Comments
 (0)