实现上述功能的代码如下,请回答下列问题。
from math import sqrt
s=input(″输入各个点的坐标,用逗号分开:″)
x1,y1,x2,y2,i,j,tot=0,0,0,0,0,0,0
k=1
for ch in s:
if ch==″,″:
j=i+1
if
x2=v
else:
y2=v
d=sqrt((x2-x1)**2+(y2-y1)**2)
tot+=d
x1=x2
y1=y2
k+=1
i+=1
print(″拆线总长度为:″+str(round(tot,2)))
(1)请在划线处填入合适代码。
(2)运行该程序,输入″5,10,8,12,6,17,″,程序执行到循环结束时,变量k为

同类型试题

y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2


y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2

