diff options
Diffstat (limited to 'challenge-123/abigail/python/ch-2.py')
| -rw-r--r-- | challenge-123/abigail/python/ch-2.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/challenge-123/abigail/python/ch-2.py b/challenge-123/abigail/python/ch-2.py index e61a2cc0c5..437dc072ff 100644 --- a/challenge-123/abigail/python/ch-2.py +++ b/challenge-123/abigail/python/ch-2.py @@ -10,15 +10,15 @@ import fileinput +def dist (x1, y1, x2, y2): + return (x1 - x2) ** 2 + (y1 - y2) ** 2 + for line in fileinput . input (): [x1, y1, x2, y2, x3, y3, x4, y4] = \ map (lambda x: int (x), line . split (' ')) - if (x1 - x2) ** 2 + (y1 - y2) ** 2 == \ - (x2 - x3) ** 2 + (y2 - y3) ** 2 == \ - (x3 - x4) ** 2 + (y3 - y4) ** 2 == \ - (x4 - x1) ** 2 + (y4 - y1) ** 2 and \ - (x1 - x3) ** 2 + (y1 - y3) ** 2 == \ - (x2 - x4) ** 2 + (y2 - y4) ** 2: + if dist (x1, y1, x2, y2) == dist (x2, y2, x3, y3) == \ + dist (x3, y3, x4, y4) == dist (x4, y4, x1, y1) and \ + dist (x1, y1, x3, y3) == dist (x2, y2, x4, y4): print (1) else: print (0) |
