Yesterday we introduced variables and how effective they can be (as a timer or point system – share in the comments if you came up with something else!) and today we jump WAY ahead in a traditional Programming Class and discuss List or Arrays.
July 10th – A Week With Scratch
In a typical progression of a Programming class, you’d spend a few weeks working with variables. Assigning them, re-assigning them, having the program change them, assigning multiple variables, and it’s all very important stuff. I only have 7 days so we jump ahead to List/Arrays – what can store the variables for more data to be processed and evaluated.
Arrays (and data) are the backbone of Computer Science, otherwise it would all be very simple programming that relied on one instance, ran the program and returned the value, but we can manipulate so much more data than that.
While there are a lot of classic “array” examples out there (collect birthdays and find mean, median, mode – ice cream sales and hot months – and all the examples that have you print out the last list item, or all items BUT, etc…) and they are all very important, but like I mentioned above, I only have 7 days.
The example that you see above is how I determine who presents first in presentations. I have the students type in their name (when they click on the Cat), which adds to an Array, then I click on the button/sprite which says the name of a random student THEN removes them from the array (the most important step).
To create this 1.) click on “Data” (2.0 version) and 2.) then “Make a List” (I called mine classList) and “Make a Variable” (I called mine studentName – because this will change) 3.) I used the “Event” of “When this sprite clicked” to ask and gather the students name “answer” and then put that in the Array “classList”. Then I 4.) Programmed the button to broadcast “message1” (not shown) which the Cat receives and 5.) sets the variable “studentName” to a random item in classList then 6.) says it for 2 seconds then 6.) deletes the variable from classList.
I use this example to always find real world ways to bring the things we are doing in the classroom to life. Tomorrow we’ll run through making a block and the next day navigating the community for a classroom!