Array Access and Update at Index
📖 Scenario: You are managing a list of daily temperatures recorded in a week. Sometimes, you need to check the temperature of a specific day or update it if there was a mistake in recording.
🎯 Goal: Build a simple program that creates a list of temperatures, sets a specific day index to a new temperature, and then prints the updated list.
📋 What You'll Learn
Create a list called
temperatures with exactly these values: 23, 25, 22, 20, 24, 26, 21Create a variable called
day_index and set it to 3Update the temperature at index
day_index in temperatures to 19Print the
temperatures list after the update💡 Why This Matters
🌍 Real World
Lists are used to store collections of data like daily temperatures, sales numbers, or scores. Being able to access and update specific items helps keep data accurate.
💼 Career
Many programming jobs require working with lists or arrays to manage data. Knowing how to access and change elements by index is a fundamental skill.
Progress0 / 4 steps