® Traveling Circuits Lesson 2 Fun with Functions a one hour introductory activity Copyright ©2014 Thinkersmith PO Box 42186, Eugene, OR, 97404 This Traveling Circuits lesson, “Fun with Functions”, is owned by Thinkersmith, including all associated text, artwork, photographs, images, and material preparations. Thinkersmith hereby grants the purchaser the permission to use, re-use, edit and duplicate any section of this document for personal and/or individual classroom use only. No part of this lesson can be re-sold or commercialized in any way without the express written consent of Thinkersmith. We do not support the distribution, or distribution of adaptations, without Thinkersmith’s written consent. All other rights reserved.. Disclaimer Neither Thinkersmith nor any other party involved in the creation of this curriculum can be held responsible for damage, mishap, or injury incurred because of this lesson. Adult supervision and supervisor caution is recommended at all times. When necessary, every effort has been made to locate copyright and permission information. Lesson 2: Fun with Functions Main Goal: Help students grasp the concept of variables while teaching them to run functions. Overview: To begin, you will show the students an art project and share steps that they can take to re-create it. These steps should be repetitive and simple to execute. In this lesson, we will create a keychain using pipe cleaners and various types of beads. Once students are familiar with the technique needed to create their keychain, have them try to fit the whole “program” onto a special piece of paper. Objectives: Students will • • • • Learn to convert real-world activities into instructions Gain practice coding instructions with symbols Gain understanding of the use of variables Learn why functions are useful in the world of coding Materials and Preparation: Estimated lesson time: 1 hour Estimated prep time: 20 min Materials • Symbol Key (1 per group) • Program Paper (1 per person) • Beads (4 per person) • Hoops (2 per person) • Special Bead (1 per person) • Bead Baggie (1 per person) • Pipe Cleaner (1 per person) • Rubber Band (1 per person) Preparation • Print out one Symbol Key for each group • Print a Program Paper for each person • Package Beads, Hoops, and Special Bead into packets for easy grabbing • Twist Pipe Cleaners in half around the rubber band to prepare for beading • Create a sample keychain to display for class Key Lesson Vocabulary: Algorithm - A series of instructions on how to accomplish a task Function - A piece of code that can be called over and over Program - A set of code that a machine can follow Variable - A symbol that can be used as placeholder for an unknown (or changing) value TRAVELING CIRCUITS - SERIES 1 COMPUTER SCIENCE © 2013 www.thinkersmith.org 1 Traveling Circuits TM Series 1: Hands-On Activity 2 Lesson Plan Introduce: Before you pass out supplies, show the students the pre-made keychain and let them know that they are going to learn how to create one for themselves. Tell them to listen carefully while you teach them the algorithm describing how the keychain was built. Put a bead on and twist, put another bead on and twist. Put on a hoop and twist. Bead, twist, bead, twist, hoop, twist. Add a special bead, then curl the tail like a snail. Did everyone get that? One more time, it’s: Bead, twist, bead, twist, hoop, twist. Bead, twist, bead, twist, hoop, twist. Special bead, curl like a snail. Have the class repeat the sequence along with you a time or two, until you are confident that they are familiar with the pattern. Adjustments: Grades K-3 • Try this lesson all together as one class. • Students may need to be guided toward discovering what patterns repeat. • Read through the finished program several times, challenging them to jump up to the “definition” for f1 when you point to the symbol “calling” f1 in the program. Grades 4-6 • The lesson should go as expected for this age. • If you have extra time, try having them do the same thing for the song “Head, Shoulders, Knees and Toes”. Grades 7+ • This can be an individual activity. • Challenge students to apply this method to something else from life, such as a song, a dance routine, or a recipe. 2 ® Lesson 2: Fun with Functions Steps: 1. Show students sample keychain. 2. Verbally explain how the keychain was made. 3. Have students repeat sequence. 4. Attempt to document “program” on small piece of Program Paper. 5. Point out that you are running out of room. 6. Challenge students to use f1 and f2 sections for sequences that repeat. 7. Let students fill out their Program Papers in groups. 8. Share a few programs that the groups created. 9. Have groups translate their programs into physical keychains. 10. Show off keychains to classmates. Kickstart: Once the class is comfortable with the pattern, let them know you’re going to write it down so that they have a “program” to follow. Tell them that you don’t want to write the words over and over, so you’re going to draw symbols to make it easier. Describe what each one means, according to the diagram below: Add Bead Add Hoop Twist Pipe Cleaner Add Special Bead Curl Ends of Pipe Cleaner These symbols will come in handy later. Now, have the class start helping you fill in the “PROGRAM” section of the Program Paper. You should be able to get through about six symbols before the class notices that something is wrong. If they don’t help them out by asking, “Am I going to be able to get all the way through this program, here?” They’ll likely confirm that you won’t, but may have no idea where to go from there. Unfold the Program Paper (or grab a new one) and suggest that there is a solution. Let them know that these papers have two special areas where you can store instructions that you use multiple times, those areas are called “functions”. In order to “call” the function, you only need to place the name of the function in the program box where you want the defined actions. TRAVELING CIRCUITS - SERIES 1 COMPUTER SCIENCE © 2013 www.thinkersmith.org 3 Traveling Circuits TM Series 1: Hands-On Activity 2 The Activity: Pass a Program Paper to each group, and let the students work together to ponder through what your words just meant. How will they find repeating sequences, program them into the function areas, then call the functions to make their program accurately replicate your keychain? Travel around and answer questions, but try not to give any clear directives. See what the class can work out. Give the students about five minutes, then ask if anyone wants to share their solutions. Review solutions as a class, analyzing for accuracy. How many solutions were found that will work? Which solution takes the fewest number of steps? Duplicate one of the solutions to keep on display for the class. Once the groups have all filled in their Program Papers with a program that gives them a correct keychain, ask the class if they’re ready to create their bauble. Pass out the packets of pre-prepared beads. When the students have their beads, but before you give them their pipe cleaners, go back to the program on display. Point to one of the bead symbols, and highlight that you don’t know what color of beads the students might have ended up with. You may not even know what size hoop they have, or what shape their special bead is. Ask them if that should prevent you from letting them know what order to put their bead, hoops, and special bead. Emphasize again that *this person* may have red beads, while *that person* has blue, but regardless, we can use the symbols that we drew as placeholders for the various options. In fact, another name for those placeholders is “variables”. Variables are words or symbols that you can use in your program that indicate where something will go, even if you don’t quite know what that something is before you write the code. Now that everyone understands, functions and variables, give them their pipe cleaners and turn them loose to create their keychains! 4 ® Lesson 2: Fun with Functions PROGRAM As you start filling in the rectangles with symbols (variables), it will soon become apparent that you will not be able to display the entire program using only these eight spots. f1 f2 PROGRAM Add the function boxes, f1 and f2, for repeating sequences, then call the sequence from inside the program. f1 f1 f2 TRAVELING CIRCUITS - SERIES 1 COMPUTER SCIENCE © 2013 www.thinkersmith.org 5 Traveling Circuits Symbol Key Lesson 2: Fun with Functions TM Fun with Functions Key: Add Bead Add Hoop Twist Pipe Cleaner Add Special Bead Curl Ends of Pipe Cleaner TRAVELING CIRCUITS - SERIES 1 COMPUTER SCIENCE © 2013 www.thinkersmith.org ® Traveling Circuits TM Program Paper Lesson 2: Fun with Functions f1 f2 PROGRAM ® TRAVELING CIRCUITS - SERIES 1 COMPUTER SCIENCE © 2013 www.thinkersmith.org Traveling Circuits TM Series 1: Hands-On Activity 2 Here are some samples of the keychains described in the lesson. Feel free to change the algorithm to suit the age group of your class. 8 ® Lesson 2: Fun with Functions TRAVELING CIRCUITS - SERIES 1 COMPUTER SCIENCE © 2013 www.thinkersmith.org 9 For more lessons, please visit www.thinkersmith.org
© Copyright 2026 Paperzz