# File: peri0.py # Compute the perimeter of a triangle; user enters the points defining it # WARNING: input is not error checked (see peri-c.py for how to do it right) # # Matt Bishop, MHI 289I, Fall 2021 # import math # load up the math functions # # read in the co-ordinates # iax = float(input("Please enter the x coordinate of the first point: ")) iay = float(input("Please enter the y coordinate of the first point: ")) ibx = float(input("Please enter the x coordinate of the second point: ")) iby = float(input("Please enter the y coordinate of the second point: ")) icx = float(input("Please enter the x coordinate of the third point: ")) icy = float(input("Please enter the y coordinate of the third point: ")) # # compute the corresponding triangle's perimeter # d1 = math.sqrt((iax - ibx) ** 2 + (iay - iby) ** 2) d2 = math.sqrt((iax - icx) ** 2 + (iay - icy) ** 2) d3 = math.sqrt((ibx - icx) ** 2 + (iby - icy) ** 2) temp = d1 + d2 + d3 # # print the corresponding triangle's perimeter # print("The perimeter is", temp)