Tạo File XuLyTamGiac.py để chứa các hàm xử lý tam giác:
import math
def laTamGiac(a,b,c):
if (a + b > c and a + c > b and b + c > a and a > 0 and b > 0 and c > 0):
kt= True
else:
kt=False
return kt
def tgDeu(a,b,c):
if (a==b==c):
kt=True
else:
kt=False
return kt
def tgCan(a,b,c):
if (a==b or a==c or b==c):
kt=True
else:
kt=False
return kt
def tgVuong(a,b,c):
if (math.pow(c, 2) == math.pow(a, 2) + math.pow(b, 2) or math.pow(a, 2) == math.pow(b, 2) + math.pow(c, 2) or math.pow(b, 2) == math.pow(a, 2) + math.pow(c, 2)):
kt=True
else:
kt=False
return kt
def DienTich(a,b,c):
cv = a + b + c;
p = cv / 2;
return math.sqrt(p * (p - a) * (p - b) * (p - c));

(Có) Không có nhận xét nào cho bài viết này
Đăng nhận xét
Hãy nhập Nhận xét cho bài viết này vào khung bên dưới. Cảm ơn...