Premium problem61. Nearest Value

Medium Locked

Find and return the value in array Z nearest to the scalar z.

Input

Z = [0.  0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1. ]
z = 0.43

Output

np.float64(0.4)

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)