Data Abstraction Hack Homework

📝 Data Abstraction Hack (10 minutes)

Instructions

In this activity, you’ll learn how lists manage data and reduce complexity in programs. Follow these steps:

  1. Edit the students list to use your own names (friends, classmates, etc.).
  2. Edit the scores list to assign each student a score of your choice.
  3. Save and refresh the page in your browser to see how the output changes automatically.
  4. After experimenting with students and scores, complete the 🚀 Hack Challenge at the bottom.
  5. To make edits, open VS Code and find the file at notebooks/csp/big-ideas/2025-09-26-bigidea32homework.ipymd.

Class Roster Output:

🚀 Hack Challenge

Now that you’ve practiced with students and scores, it’s your turn! Create one new list of your choice.

✅ Ideas:

  • A list of favoriteFoods
  • A list of cities you want to visit
  • A list of videoGames you enjoy

After creating your new list, write a loop to print each element to the page.

// Example structure:
let favoriteFoods = ["Pizza", "Burgers", "Sushi"];

for (let i = 0; i < favoriteFoods.length; i++) {
  console.log(favoriteFoods[i]); // Replace console.log with output to the page if you like
}
  

💡 Hint: Use the same pattern you saw with students and scores.

Questions

1. Roster basics

2. Parallel lists

safe remove, You have parallel arrays:

let students = ["Aneesh", "Ethan", "Tanay"];
students.push("Neil");
students[students.indexOf("Ethan")] = "Ethen";
students.shift(); 

students; 
let students = ["Aneesh", "Ethan", "Tanay", "Neil"];
let scores   = [100, 92, 90, 85];

let i = students.indexOf("Tanay");
if (i !== -1) {
  students.splice(i, 1);
  scores.splice(i, 1);
}