Skip to content

Instantly share code, notes, and snippets.

@robivirt
Created May 15, 2019 16:50
Show Gist options
  • Select an option

  • Save robivirt/e6a20c297ecf7afdf2417b3dabe27f46 to your computer and use it in GitHub Desktop.

Select an option

Save robivirt/e6a20c297ecf7afdf2417b3dabe27f46 to your computer and use it in GitHub Desktop.
import math
class Vector:
def __init__(self, x_, y_):
self.x = x_
self.y = y_
def __len__(self):
return math.hypot(self.x, self.y)
def __mul__(self, other):
return self.x * other.x + self.y * other.y
def __add__(self, other):
return Vector(self.x + other.x, self.y + other.y)
def angle(self, other):
return math.acos(self * other / len(self) / len(other))
x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
x3, y3 = map(int, input().split())
a = Vector(x1, y1)
b = Vector(x2, y2)
c = Vector(x3, y3)
a = len(a)
b = len(b)
c = len(c)
a, b, c = sorted([a, b, c])
if a ** 2 + b ** 2 == c ** 2:
print('прямоугольный')
elif a ** 2 + b ** 2 < c ** 2:
print('тупоугольный')
else:
print('остроугольный')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment