__director

判断三点能否构成三角形

listA = [(2,3),(3,5),(5,7)]

listB = [(1,2),(2,4),(4,8)]

def tri(arg):
    x0,y0 = arg[0]
    x1,y1 = arg[1]
    x2,y2 = arg[2]
    if (y0-y1)*(x0-x2) == (y0-y2)*(x0-x1):
        return ('不能构成三角形')
    else:
        return ('能够成三角形')


print(tri(listA))
print(tri(listB))

 

posted on 2020-04-25 15:26  __director  阅读(1063)  评论(0编辑  收藏  举报

导航