Find the perimeter of overlapping rectangles , given the top right and bottom left corners.
# Find the perimeter of overlapping rectangles
s = input('Top right conner: ')
s = s.split()
top = float(s[0])
right = float(s[1])
s = input('Bottom left conner: ')
s = s.split()
bottom = float(s[0])
left = float(s[1])
perimeter = 2*abs(bottom-top) + 2*abs(right - left)
print(f'The perimeter is {perimeter}')
Comments
Leave a comment