Welcome to the final chapter: Modules! 📦
💡 Think of it like this: A module is like a toolbox. Python comes with many built-in toolboxes (modules), and you can grab specific tools from them using import.
Useful built-in modules:
random — Generate random numbers and choicesmath — Math functions like sqrt(), pidatetime — Work with dates and timesos — Interact with your computer's file systemIn this exercise, we'll use the random module to build a slot machine! 🎰
import random # random.randint(1, 6) → random number from 1 to 6 (like a dice!) print(random.randint(1, 6)) # random.choice(['a', 'b', 'c']) → pick a random item print(random.choice(['🍎', '🍌', '🍒']))