Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the plot title to 'Sales Data'.
Pandas
df.plot() plt.[1]('Sales Data') plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plt.xlabel instead of plt.title
Forgetting to call plt.show() to display the plot
✗ Incorrect
The plt.title() function sets the title of the plot.
2fill in blank
mediumComplete the code to label the x-axis as 'Month'.
Pandas
df.plot() plt.[1]('Month') plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plt.ylabel instead of plt.xlabel
Not labeling the axis at all
✗ Incorrect
The plt.xlabel() function sets the label for the x-axis.
3fill in blank
hardFix the error in the code to set the figure size to 10 by 5 inches.
Pandas
df.plot(figsize=[1])
plt.show() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using list or set instead of tuple for figsize
Passing two separate numbers without parentheses
✗ Incorrect
The figsize parameter expects a tuple like (width, height).
4fill in blank
hardFill both blanks to set the plot title to 'Revenue' and y-axis label to 'Amount'.
Pandas
df.plot() plt.[1]('Revenue') plt.[2]('Amount') plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up xlabel and ylabel
Using legend instead of labels
✗ Incorrect
plt.title() sets the plot title and plt.ylabel() sets the y-axis label.
5fill in blank
hardFill all three blanks to set figure size to (8,4), title to 'Profit', and x-axis label to 'Quarter'.
Pandas
df.plot(figsize=[1]) plt.[2]('Profit') plt.[3]('Quarter') plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using list instead of tuple for figsize
Swapping xlabel and title functions
✗ Incorrect
Use a tuple for figsize, then plt.title() and plt.xlabel() for labels.