# Libraries & Modules > Tenth graders learn to reuse code with libraries and modules — collections of pre-written, tested code you can import instead of writing from scratch… **Computer Science** | **Grade 10** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g10-cs-libraries.html* Tenth graders learn to reuse code with libraries and modules — collections of pre-written, tested code you can import instead of writing from scratch. Python’s standard library and installable packages save time and effort. They explore the ideas, then use a module. **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 a **library**. - Use **import**. - Know the **standard library**. - Reuse code. Why reinvent the wheel when you can reuse code others wrote? Project this and tap each. Have students explore libraries and modules. ## 50 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — Don’t Reinvent It Need a random number or a square root — do you really code that yourself? #### 👩‍🏫 Teacher Moves - Pose the question. - Share ideas. - Set the goal. #### 🎒 Student Actions - Think. - Share. - Get ready. ### Use — Libraries Students learn. #### 👩‍🏫 Teacher Moves - Send students to Libraries & Modules. - Tap each idea. - Note import to reuse. #### 🎒 Student Actions - Tap each. - Say. - Note it. ### Modify — Use One Students practice. #### 👩‍🏫 Teacher Moves - import random. - Use random.randint(). - Try a math function. #### 🎒 Student Actions - Import. - Use. - Try. ### Create — Create Students apply. #### 👩‍🏫 Teacher Moves - Pick a module for a task. - Use one of its functions. - Explain why it helped. #### 🎒 Student Actions - Pick. - Use. - Explain. ### Reflect — Reflect Students close. #### 👩‍🏫 Teacher Moves - What is a library? - What does import do? - Complete the exit ticket. #### 🎒 Student Actions - Say it. - Say it. - 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. Incorporate existing code and libraries. Modify and remix using libraries. Test programs that use modules. Build on existing computational work. ## One lesson, every learner ### Multilingual Learners - Module example cards. - Frame: "import lets me use ___." - Demo a module live. ### Support & Access - Use import random only. - Use one function. - Use a template. ### Stretch & Extend - Explore 3 standard modules. - Install a package with pip. - Read module documentation. ### What to gather - 📽️Screen / board - 📚Module cards - 💻Libraries & Modules - 💻Python - 📓Notebooks - 🎫Exit-ticket slips ### Key terms - **library**: reusable collections of code - **module**: a file of reusable code - **import**: bring in a module - **standard library**: modules built into Python - **package**: an installable library - **pip**: the tool to install packages - **function**: a reusable block of code - **reuse**: use existing code again ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### Reflect: libraries & modules. Have students use a module function in a small program. A printable module sheet is in the CS library. ## Check your understanding **1. What does “library” mean?** - modules built into Python - the tool to install packages - use existing code again - reusable collections of code *(correct)* “library” means: reusable collections of code **2. Which word means: “a file of reusable code”?** - function - pip - library - module *(correct)* “module” means: a file of reusable code **3. What does “import” mean?** - a file of reusable code - modules built into Python - bring in a module *(correct)* - an installable library “import” means: bring in a module **4. Which word means: “modules built into Python”?** - module - reuse - pip - standard library *(correct)* “standard library” means: modules built into Python **5. What does “package” mean?** - reusable collections of code - use existing code again - a reusable block of code - an installable library *(correct)* “package” means: an installable library **6. Which word means: “the tool to install packages”?** - import - reuse - pip *(correct)* - standard library “pip” means: the tool to install packages ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g10-cs-libraries.html All lessons: https://lessonplans.k12academics.com/