CODING - Grade K
Lesson
Unplugged Coding
Coding works on Logical Thinking
CODING - Grade K
Lesson
Unplugged Coding
Coding works on Logical Thinking
Definition: A loop is a command that repeats a part of code a certain number of times.
Individual, Pairs, or Groups | Materials: Paper and pencil (optional)
The learner decides if they want to create a fun workout routine or a dance routine.
Come up with three physical actions to perform. For a workout routine, this could be a jumping jack, pushup, and sit-up. For a dance routine, this could be a spin, clap, and wiggle.
Decide how many times each action should be repeated, or “looped”. For example, “spin 2 times, clap 5 times, wiggle one time”.
Perform the routine all together, looping each action the designated number of times. Then, try looping the entire routine at least twice!
As an extension, invite a partner to execute the same commands and perform the routine together!
Coding Connection: A loop can be used to repeat a physical action, just like a loop in coding will repeat a portion of code a certain number of times.
Definition: A function is a defined set of steps that result in a single outcome and can be used more than once.
Individual | Materials: Paper and pencil, printer (optional)
Pick a simple song for which you know the tune and lyrics. For example, "Happy Birthday" or "Twinkle Twinkle Little Star".
Look at the printed lyrics or sing the song, and try to find lines that are repeated multiple times. For example, in the “Happy Birthday” song, the line “Happy birthday to you” is repeated 3 times.
Next, sing the song again, but this time replace all the repeated lyrics with the word “Function”. So the Happy Birthday song would go “Function, Function, Happy birthday dear _____, Function”
Count the number of times the word “Function” comes up!
For an extension, replace the word "Function" with some brand new lyrics that you invent, and come up with a remixed song!
Coding Connection: Many songs have a hook or chorus that includes the exact same lyrics and repeats in multiple places throughout the song. Similarly, there are certain lines of code that a programmer might want to repeat throughout a program. To do this, they use a function!
Individual | Materials: Multi-colored beads, string or colored noodles
Cut a piece of string so it is just longer than wrist-size. Tie a knot at the end of a string.
Decide on a pattern of 3 beads that you want to repeat multiple times in your bracelet. For example, Pink-Blue-Pink. We can call this set of beads a “function”.
Start stringing beads onto the yarn. After 5 beads, add your first “function”. In this example, this means the pattern of Pink-Blue-Pink.
Add 5 more beads. Then, add your function again. Repeat this process until the string is full with beads.
Tie a knot on the other end and display your finished bracelet!
Observe - How many times were you able to repeat the function beads?
Coding Connection: Each bead represents a line of code. Programmers will often want to use certain lines of code again and again throughout a program, so they store that code in a function. The repeating bead pattern is one easy way to visualize this process!