回答編集履歴

1

書式の改善

2023/06/11 14:43

投稿

little_street
little_street

スコア404

test CHANGED
@@ -42,8 +42,8 @@
42
42
 
43
43
  ind_xr = np.empty_like(xr, dtype=int)
44
44
  for i, xi in enumerate(xr):
45
- ind = bisect_left(xl, xi)
45
+ n = bisect_left(xl, xi)
46
- ind_xr[i] = ind - 1 if xl[ind] - xi > xi - xl[ind - 1] else ind
46
+ ind_xr[i] = n - 1 if xl[n] - xi > xi - xl[n - 1] else n
47
47
 
48
48
  np.set_printoptions(suppress=True)
49
49
  print(xl[ind_xr] - xr)