<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Widgets in a Jupyter Notebook
An example of using version 4.x widgets in a Jupyter Notebook.
Reference
Step1:  Define a sine wave
Step2:  Plot the sine wave
Step3:  Define a function that allows a user to vary the wavenumber of the sine wave
Step4:  For example
Step5:  Use a slider widget to call sine_plotter and interactively change the wave number of the sine wave
<ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from ipywidgets import interact
Explanation: Widgets in a Jupyter Notebook
An example of using version 4.x widgets in a Jupyter Notebook.
Reference: https://ipywidgets.readthedocs.io/en/latest/.
Depending on the current state of your Python installation, you may have to install the ipywidgets package, have notebook&gt;=4.2.0, and enable widgets.
$ pip install ipywidgets
$ jupyter nbextension enable --py --sys-prefix widgetsnbextension
All of the imports:
End of explanation
x = np.linspace(0, 1, 101)
k = 2
f = np.sin(2*np.pi * k * x)
Explanation: Define a sine wave:
End of explanation
plt.plot(x, f)
Explanation: Plot the sine wave:
End of explanation
def sine_plotter(wave_number):
    plt.plot(x, np.sin(2*np.pi * x * wave_number), 'r')
Explanation: Define a function that allows a user to vary the wavenumber of the sine wave:
End of explanation
sine_plotter(5)
Explanation: For example:
End of explanation
interact(sine_plotter, wave_number=(1, 10, 0.5))
Explanation: Use a slider widget to call sine_plotter and interactively change the wave number of the sine wave:
End of explanation
<END_TASK>