Complete the code to import the animation module from matplotlib.
from matplotlib import [1]
The animation module is imported from matplotlib to create animations.
Complete the update function to set new y-data for the line in the animation.
def update(frame): y = [i * frame for i in range(5)] line.set_[1](y) return line,
The y-data of the line is updated using the set_ydata() method.
Fix the error in the update function to correctly return the updated line object as a tuple.
def update(frame): y = [frame + i for i in range(5)] line.set_ydata(y) return [1]
The update function must return a tuple of the updated artists, so (line,) is correct.
Fill both blanks to create an animation object that updates the line every 100 milliseconds for 50 frames.
ani = animation.FuncAnimation(fig, [1], frames=[2], interval=100)
The FuncAnimation needs the update function and the number of frames to animate.
Fill all three blanks to create a dictionary comprehension that maps each word to its length if the length is greater than 3.
lengths = { [1]: [2] for [3] in words if len([3]) > 3 }The dictionary comprehension uses the word as key and its length as value, iterating over words.