# Mutable vs Immutable > Tenth graders learn a key programming idea — some values are mutable (can be changed in place, like lists and dictionaries) and some are immutable (cannot… **Computer Science** | **Grade 10** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g10-cs-mutable.html* Tenth graders learn a key programming idea — some values are mutable (can be changed in place, like lists and dictionaries) and some are immutable (cannot, like strings, numbers, and tuples). This affects how data behaves in your code. They sort the types, then test it. **Copy link** works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment. ## Everything you need before the bell rings ### Learning Objectives Students will be able to… - Define **mutable** & **immutable**. - Sort the **types**. - See why it **matters**. - Test it. Can every value in your program be changed after you create it? ## Mutable, or Immutable? Project this and sort each into Mutable or Immutable. ## 50 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — Can It Change? Once you make a string, can you change a letter inside it directly? #### 👩‍🏫 Teacher Moves - Pose the question. - Share ideas. - Set the goal. #### 🎒 Student Actions - Think. - Share. - Get ready. ### Use — Mutable vs Immutable Students learn. #### 👩‍🏫 Teacher Moves - Send students to Mutable or Immutable? - Sort each type. - Note lists change, strings don’t. #### 🎒 Student Actions - Sort. - Say. - Note it. ### Modify — Try It Students practice. #### 👩‍🏫 Teacher Moves - Change a list item. - Try to change a string letter. - See what happens. #### 🎒 Student Actions - List. - String. - Compare. ### Create — Create Students apply. #### 👩‍🏫 Teacher Moves - Pick the right type for a task. - Explain mutable vs immutable. - Use it in code. #### 🎒 Student Actions - Pick. - Explain. - Use. ### Reflect — Reflect Students close. #### 👩‍🏫 Teacher Moves - What is mutable? - Name an immutable type. - Complete the exit ticket. #### 🎒 Student Actions - Say it. - Name one. - Complete the exit ticket. ## Built to the standards you report on Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students. Understand data-type properties. Choose data structures wisely. Debug mutation issues. Reason about data behavior. ## One lesson, every learner ### Multilingual Learners - Mutable/immutable cards. - Frame: "a list is ___." - Demonstrate each. ### Support & Access - Sort list vs string. - Use 4 types. - Use examples. ### Stretch & Extend - Explore aliasing. - Copy vs reference. - Why tuples as keys. ### What to gather - 🔄Type cards - 📽️Screen / board - 💻Mutable or Immutable? - 💻Python - 📓Notebooks - 🎫Exit-ticket slips ### Key terms - **mutable**: can be changed in place - **immutable**: cannot be changed - **list**: mutable collection - **tuple**: immutable collection - **string**: immutable text - **integer**: an immutable number - **in place**: changing the original - **value**: the data stored ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### Reflect: mutable vs immutable. Have students test changing a list vs a string. A printable types sheet is in the CS library. ## Check your understanding **1. What does “mutable” mean?** - an immutable number - can be changed in place *(correct)* - changing the original - cannot be changed “mutable” means: can be changed in place **2. Which word means: “cannot be changed”?** - immutable *(correct)* - value - mutable - string “immutable” means: cannot be changed **3. What does “list” mean?** - changing the original - mutable collection *(correct)* - immutable collection - immutable text “list” means: mutable collection **4. Which word means: “immutable collection”?** - value - list - string - tuple *(correct)* “tuple” means: immutable collection **5. What does “string” mean?** - an immutable number - immutable text *(correct)* - can be changed in place - the data stored “string” means: immutable text **6. Which word means: “an immutable number”?** - in place - immutable - integer *(correct)* - string “integer” means: an immutable number ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g10-cs-mutable.html All lessons: https://lessonplans.k12academics.com/