Why patterns matter for safety
📖 Scenario: Imagine you are building a small program to check if certain actions are safe to perform based on a list of safety patterns. These patterns help prevent mistakes and keep things secure, like wearing a helmet when riding a bike or checking if a door is locked before leaving.
🎯 Goal: You will create a TypeScript program that stores safety patterns, sets a threshold for safety importance, filters the patterns based on that threshold, and then shows which patterns are important for safety.
📋 What You'll Learn
Create a dictionary called
safetyPatterns with exact keys and numeric values representing importance.Create a variable called
importanceThreshold with the exact value 5.Use a dictionary comprehension (object comprehension) to create a new dictionary called
importantPatterns that only includes patterns with importance greater than or equal to importanceThreshold.Print the
importantPatterns dictionary.💡 Why This Matters
🌍 Real World
Safety patterns help prevent accidents and mistakes in many areas like driving, working with machines, or software security.
💼 Career
Understanding how to filter and manage data based on conditions is a key skill in programming jobs, especially when working with safety-critical systems.
Progress0 / 4 steps