import math as m
def Perimeter():
x1 = int(input("x1 = "))
y1 = int(input("y1 = "))
x2 = int(input("x2 = "))
y2 = int(input("y2 = "))
x3 = int(input("x3 = "))
y3 = int(input("y3 = "))
print("A({};{})\tB({};{})\tC({};{})".format(x1,y1,x2,y2,x3,y3))
""" √ ((X ₂-X ₁) ² + (Y ₂-Y ₁) ²) +
√ ((X ₃-X ₂) ² + (Y ₃ — Y ₂) ²) +
√ ((X ₃-X ₁) ² + (Y ₃-Y ₁) ²). """
p = m.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) + m.sqrt((x3 - x2) ** 2 + (y3 - y2) ** 2) + m.sqrt(
(x3 - x1) ** 2 + (y3 - y1) ** 2)
print('Периметр: P = {}.'.format(p))
print('Полупериметр: p = {}.'.format(p/2))
Perimeter()
import math as m
def Perimeter():
x1 = int(input("x1 = "))
y1 = int(input("y1 = "))
x2 = int(input("x2 = "))
y2 = int(input("y2 = "))
x3 = int(input("x3 = "))
y3 = int(input("y3 = "))
print("A({};{})\tB({};{})\tC({};{})".format(x1,y1,x2,y2,x3,y3))
""" √ ((X ₂-X ₁) ² + (Y ₂-Y ₁) ²) +
√ ((X ₃-X ₂) ² + (Y ₃ — Y ₂) ²) +
√ ((X ₃-X ₁) ² + (Y ₃-Y ₁) ²). """
p = m.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) + m.sqrt((x3 - x2) ** 2 + (y3 - y2) ** 2) + m.sqrt(
(x3 - x1) ** 2 + (y3 - y1) ** 2)
print('Периметр: P = {}.'.format(p))
print('Полупериметр: p = {}.'.format(p/2))
Perimeter()