Complete the code to set the transparency of the scatter plot points.
import matplotlib.pyplot as plt plt.scatter([1, 2, 3], [4, 5, 6], alpha=[1]) plt.show()
The alpha parameter controls transparency and must be between 0 (fully transparent) and 1 (fully opaque). 0.5 sets half transparency.
Complete the code to plot two overlapping scatter plots with transparency.
import matplotlib.pyplot as plt plt.scatter([1, 2, 3], [4, 5, 6], alpha=[1], color='red') plt.scatter([2, 3, 4], [5, 6, 7], alpha=0.3, color='blue') plt.show()
Setting alpha to 0.8 makes the red points slightly transparent so overlapping with blue points is visible.
Fix the error in the code to correctly apply transparency to the scatter plot.
import matplotlib.pyplot as plt plt.scatter([1, 2, 3], [4, 5, 6], alpha=[1]) plt.show()
Alpha must be a float between 0 and 1, not a string or invalid number.
Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.
words = ['data', 'ai', 'science', 'ml'] lengths = {word: [1] for word in words if [2]
The dictionary comprehension maps each word to its length only if the length is greater than 3.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths only if length is greater than 4.
words = ['apple', 'data', 'science', 'ai'] result = [1]: [2] for w in words if [3]
The comprehension creates a dictionary with uppercase words as keys and their lengths as values, filtering words longer than 4 characters.