Complete the code to add a title to the plot.
plt.plot(x, y) plt.[1]('Sales Over Time') plt.show()
The title function adds a title to the plot, which helps tell the story of the data.
Complete the code to add an annotation pointing to the highest sales point.
max_index = y.index(max(y)) plt.plot(x, y) plt.annotate('Peak Sales', xy=(x[max_index], y[max_index]), xytext=(x[max_index], y[max_index]+5), arrowprops={'arrowstyle': '[1]'}) plt.show()
The arrow style '->' draws a simple arrow pointing from the text to the data point.
Fix the error in the annotation code by completing the missing parameter.
plt.plot(x, y) plt.annotate('Lowest Point', xy=(x[0], y[0]), xytext=(x[0], y[0]-5), [1]={'arrowstyle': '->'}) plt.show()
The arrowprops parameter is required to define the arrow style in annotations.
Fill both blanks to create a dictionary comprehension that annotates points with sales above 50.
annotations = {x: y[1] for x, y in data.items() if y [2] 50}The comprehension doubles the sales values (using *2) and filters for sales greater than 50.
Fill all three blanks to create a dictionary comprehension that annotates words longer than 3 letters with their uppercase form.
annotations = { [1]: [2] for word in words if len(word) [3] 3 }The comprehension uses the word as key, its uppercase as value, and filters words longer than 3 letters.