Skip to content

Commit e15a0bf

Browse files
Solved for issue python-geeks#94
1 parent f8ebc59 commit e15a0bf

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

1232/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Hi, rahulvansh66! Here is my help . My code is on Python3 scenario
2+
3+

1232/leetcode1232.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import math
2+
class Solution:
3+
def checkStraightLine(self, coord: List[List[int]]) -> bool:
4+
coord = sorted(coord)
5+
x = []
6+
for i in range(len(coord)-1):
7+
if((coord[i][0] - coord[i+1][0])==0):
8+
if((coord[i][1] - coord[i+1][1])>0):
9+
x.append(math.atan(float("inf")))
10+
elif((coord[i][1] - coord[i+1][1])<0):
11+
x.append(math.atan(float("-inf")))
12+
else:
13+
x.append(math.atan((coord[i][1] - coord[i+1][1])/(coord[i][0] - coord[i+1][0])))
14+
return True if(len(set(x))== 1) else False

0 commit comments

Comments
 (0)