Ответ:
Python3:
import matplotlib.pyplot as plt
points = {'A': (3, 7), 'B': (2, 12), 'C': (4, 9), 'D': (11, 10), 'E': (12, 12), 'F': (13, 10), 'G': (20, 9), 'H': (14, 7), 'I': (4, 8), 'J': (15, 8), 'K': (14, 9), 'L': (11, 6)}
x = [point[0] for point in points.values()]
y = [point[1] for point in points.values()]
plt.scatter(x, y)
order = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'L', 'K']
for i in range(len(order) - 1):
plt.plot([points[order[i]][0], points[order[i+1]][0]], [points[order[i]][1], points[order[i+1]][1]], color='black')
plt.show()
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
Python3:
import matplotlib.pyplot as plt
points = {'A': (3, 7), 'B': (2, 12), 'C': (4, 9), 'D': (11, 10), 'E': (12, 12), 'F': (13, 10), 'G': (20, 9), 'H': (14, 7), 'I': (4, 8), 'J': (15, 8), 'K': (14, 9), 'L': (11, 6)}
x = [point[0] for point in points.values()]
y = [point[1] for point in points.values()]
plt.scatter(x, y)
order = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'L', 'K']
for i in range(len(order) - 1):
plt.plot([points[order[i]][0], points[order[i+1]][0]], [points[order[i]][1], points[order[i+1]][1]], color='black')
plt.show()