Logical values
📖 Scenario: Imagine you are working with a list of temperatures recorded over a week. You want to find out which days were hot, meaning the temperature was above 30 degrees Celsius.
🎯 Goal: You will create a logical array that shows true for days with temperatures above 30 and false otherwise.
📋 What You'll Learn
Create a variable called
temperatures with the exact values: [28, 31, 29, 35, 27, 33, 30]Create a variable called
threshold and set it to 30Create a logical array called
isHot that is true where temperatures are greater than thresholdDisplay the
isHot array using disp💡 Why This Matters
🌍 Real World
Logical arrays are useful to filter data, such as finding days with high temperatures or selecting items that meet certain conditions.
💼 Career
Understanding logical values is important for data analysis, engineering, and scientific computing jobs where decision-making based on conditions is common.
Progress0 / 4 steps