Why indexing matters
📖 Scenario: Imagine you have a list of daily temperatures for a week. You want to find the temperature on a specific day and also change the temperature for a day if needed.
🎯 Goal: You will create a NumPy array of temperatures, select a specific day's temperature using indexing, update a temperature, and then print the updated array.
📋 What You'll Learn
Create a NumPy array called
temps with the exact values: 22, 24, 19, 23, 25, 20, 21Create a variable called
day_index and set it to 3Use
day_index to get the temperature for that day from temps and store it in selected_tempUpdate the temperature at
day_index in temps to 26Print the updated
temps array💡 Why This Matters
🌍 Real World
Indexing is important when working with data like daily temperatures, sales numbers, or any list of values where you want to access or change specific items.
💼 Career
Data scientists often need to select and update data points efficiently using indexing in arrays or tables.
Progress0 / 4 steps