Advertisement
GalinaKG

03. Longer Line

Jun 11th, 2022
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. from math import floor
  2.  
  3.  
  4. def center_point(x1, y1, x2, y2, x3, y3, x4, y4):
  5.  
  6.     x1_y1 = abs(x1) + abs(y1)
  7.     x2_y2 = abs(x2) + abs(y2)
  8.     x3_y3 = abs(x3) + abs(y3)
  9.     x4_y4 = abs(x4) + abs(y4)
  10.     first_2_point_sum = x1_y1 + x2_y2
  11.     second_2_point_sum = x3_y3 + x4_y4
  12.  
  13.     if first_2_point_sum >= second_2_point_sum:
  14.         if x2_y2 < x1_y1:
  15.             print(f'({floor(x2)}, {floor(y2)})({floor(x1)}, {floor(y1)})')
  16.         else:
  17.             print(f'({floor(x1)}, {floor(y1)})({floor(x2)}, {floor(y2)})')
  18.     else:
  19.         if x4_y4 < x3_y3:
  20.             print(f'({floor(x4)}, {floor(y4)})({floor(x3)}, {floor(y3)})')
  21.         else:
  22.             print(f'({floor(x3)}, {floor(y3)})({floor(x4)}, {floor(y4)})')
  23.  
  24.  
  25. center_point(x1=float(input()), y1=float(input()), x2=float(input()), y2=float(input()), x3=float(input()),
  26.              y3=float(input()), x4=float(input()), y4=float(input()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement