Ambassador Coding Basics Badge Activity
Translate a Song into Pseudocode
Time needed: 30 minutes
Pen or pencil
Writing songs is a complicated process, but it can be broken into a sequence of steps, or an algorithm. An algorithm is a series of specific instructions that can be applied to many situations. For example, a step-by-step recipe or a set of directions from one place to another are two examples of algorithms you might already use!
When programmers start working on a new idea, they often sketch out their ideas on paper before they move on to coding their algorithms on a computer. Pseudocode is a way to plan a computer program using human-friendly language. It’s not actual coding, but rather a written description of the key elements of an algorithm or program. It’s used as a quick way of thinking about a program without completely writing it out in code. It saves time and still lets a programmer check that their program will run.
For this activity, you’re the programmer! Translate a song into a short program of three or more functions to make an algorithm. Then, give the algorithm to someone else who will use it to sing the song.
Note: If you don’t have a partner for the activity, that’s okay! You can follow your coded algorithm to sing the song on your own.
First, check out pages 1 and 2 of the Song Functions handout. Make sure you understand what functions, arguments, and variables are and how to write them with the correct syntax. Look at the examples that work as well as those that don’t!
Next, you’re going to translate a set of song lyrics into code. To get started, choose a song that promotes positive social change. All kinds of music, from folk to hip-hop to rock ’n’ roll to country, have included lyrics that send messages of equality and positive change. For example:
You might know songs from the civil rights movement.
You might know songs that are famous from history or are newer from current social movements.
You might know other songs with a positive message about relationships, self-esteem, or resilience.
You might create your own song to promote social change.
Once you’ve chosen a song, write down the lyrics on a sheet of paper and brainstorm how you can translate them into pseudocode:
What are the different parts of the song? How many verses are there? What’s the chorus?
How can parts of the song become steps in the program?
Is there a part that repeats? How might this look in your program?
Do different parts of the song look similar? If so, they can use similar code!
Rewrite the lyrics on page 3 of the Song Functions handout, breaking the song into different pieces. Then, translate each part using the sing() function.
As you write your program, make sure to use functions, arguments, and variables. Remember to be as specific as possible—once you hand over your algorithm, the “computer” won’t be able to ask questions and you won’t be able to provide any additional instructions!
After you’ve translated the song, share your program with someone else who can play the role of a computer and sing the song by following the instructions. If you don’t have a partner, that’s okay—just follow your own instructions, step by step, to see if you can sing the song correctly.
If the “computer” doesn’t follow the instructions correctly, that’s okay. It might take multiple tries to code the song correctly, so mistakes are to be expected. In computer programming, getting code right is a learning process—you can expect to make mistakes, but also know that you can fix them. In fact, sometimes a mistake leads to unexpected results!
And that’s it! Now that you’ve translated the song into code, you could give the program to someone else (or a computer!) to follow and sing the song.
This activity reminds us how a complex activity, such as writing a song, can be broken down into a sequence of individual actions or an algorithm. Using an algorithm helps because it’s efficient and general. The functions are simple enough to describe one part of the song and can also be reused—think of the sing() function. Once coded, the program can be shared with someone else or run by a computer.
Troop Leaders: The instructions for all badge steps are available free of charge in your Girl Scout Volunteer Toolkit.
Girl Scouts at Home activities have been adapted from existing Girl Scout programming and optimized for use at home during a period of social distancing.
Adapted from Step 1 of
the Ambassador Coding Basics badge.