Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def longer_line(x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4):
- line1 = math.sqrt((math.pow((x_1 - x_2), 2) + math.pow((y_1 - y_2), 2)))
- line2 = math.sqrt((math.pow((x_3 - x_4), 2) + math.pow((y_3 - y_4), 2)))
- if line1 >= line2 and (pow(x_1, 2) + pow(y_1, 2)) <= (pow(x_2, 2) + pow(y_2, 2)):
- print(f"({math.floor(x_1)}, {math.floor(y_1)})({math.floor(x_2)}, {math.floor(y_2)})")
- elif line1 >= line2:
- print(f"({math.floor(x_2)}, {math.floor(y_2)})({math.floor(x_1)}, {math.floor(y_1)})")
- elif line1 < line2 and (pow(x_3, 2) + pow(y_3, 2)) <= (pow(x_4, 2) + pow(y_4, 2)):
- print(f"({math.floor(x_3)}, {math.floor(y_3)})({math.floor(x_4)}, {math.floor(y_4)})")
- else:
- print(f"({math.floor(x_4)}, {math.floor(y_4)})({math.floor(x_3)}, {math.floor(y_3)})")
- x1 = float(input())
- y1 = float(input())
- x2 = float(input())
- y2 = float(input())
- x3 = float(input())
- y3 = float(input())
- x4 = float(input())
- y4 = float(input())
- longer_line(x1, y1, x2, y2, x3, y3, x4, y4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement