Project 19: Theme Picker Simulator
Data Engineer
Builds on these lessons
Current Task
Objective
np.random.choice() picks random values from a given list, optionally weighted by a p (probability) array that must sum to 1.
Task: seed the generator with 1, then randomly pick 10 themes with light/dark/auto weighted 30%/50%/20%.
index.py
import numpy as np
np.random.seed(1)
themes = np.random.choice(['light', 'dark', 'auto'], p=[0.3, 0.5, 0.2], size=10)
print(themes)
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview