Untitled
pakka finalunknown
python
4 years ago
973 B
3
Indexable
import math def distance_point(point_a, point_b): return (math.sqrt(math.pow((point_a[0] - point_b[0]), 2) + math.pow((point_a[1] - point_b[1]), 2))) def check_straight(point_a, point_b, point_c): return (distance_point(point_a, point_b) + distance_point(point_b, point_c) == distance_point(point_a, point_c)) def check_main(points_list): for i in range(len(points_list) - 2): if check_straight(points_list[i], points_list[i - 1], points_list[i - 2]): pass else: return 0 slope = (points_list[i - 2][i - 1] - points_list[i - 1][i - 1]) / (points_list[i - 2][i - 0] - points_list[i - 1][i - 0]) return f"y - {points_list[i - 1][i - 1]} = {slope}(x - {points_list[i - 1][i - 0]})" num_points = int(input("Enter no of points: ")) points = [] for _ in range(num_points): point_x = int(input()) point_y = int(input()) point = (point_x, point_y) points.append(point)
Editor is loading...