Week 5
Using Lists of Data
Weekly Summary
Sometimes a variable stores a single value. In our previous module
- "name" stored the user's name
- "pet" stored the user's pet type
But sometimes we need a variable to store a collection of data rather than a single value.
- The 4 answers to a multiple choice question
- The 12 valid months in a drop down menu where you set your birthday
- The 50 valid entries for the "state" field when entering your address.
This week we look at how Scratch manages these collections in a data structure called a "list." To be honest, this topic won't be deeply covered on your first competency demo. HOWEVER< the use of lists will become very important in our unit on Python. So we want to consider it here to help us later.
Lessons
One more TIPP&SEE activity:
- Visit https://scratch.mit.edu/projects/109260149/
- Complete the TIPP&SEE process.
- You may need to look carefully once you dig in to the code, but see what you can do to identify the completely new feature(s) in this program.
Please watch the following videos which total approximately 60 minutes of "required" plust some Challenge problems.
- 5.1 - All You Hungry Children
Introduction
- The starter code so that you can remix and follow along
- 5.2 - What is a List
- 5.3 - Using a List
- 5.4 - Costumes can be like lists
- 5.5 - The State Capital Quiz Introduced
- 5.6 - Loading/Capturing the Data
- 5.7 - [TASK] Challenge - Can you produce the quiz
- 5.8 - My solution to the one state at a time quiz
- [CHALLENGE] - These go beyond the outcomes of this course but are probably worth watching even if confusing
- 5.9 - Explanation - Make it a multiple state quiz
- 5.10 - Using a semi-random list to get 10 "random" states with no repeats
- 5.11 - Using a truly random list to get 10 "random" states with no repeats (No video - Just read my code and try to figure it out)
Practice
Next, I would like you to spend 30 minutes on this non-graded, guided task. In it you will explore some programs that use lists to see how they work and make some additions/modifications. I think this is a good practice/transition to your full graded assignment later.
Assignment
Finally, I would like you to complete the following, graded, homework assignment.