Warm Up (5 minutes)
Activity (30 minutes)
Wrap Up (10 minutes)
5.4 MAKE document - with rubric
list.length: evaluates the number of items in the list and generates a number
list.length - 1: gives you the last element of your list
string.length: gives the length of the string it represents
See example of strings using indicies, but you must have a var for the string
string.substring (start, end) : when you want only a part of the string. It returns a substring starting at the start, and going up to but NOT including the end
See example of the how a substring chooses parts of a string
Previous Vocabulary
LIST: an ordered collection of elements
ELEMENT: an individual value in a list that is assigned a unique index
INDEX: a common method for referencing the elements in a list or string using numbers
Note: Lists are an example of data abstraction. They allow us to name and program with large collections of information while ignoring the low level details of how the data is stored, organized, etc. These programs are easier to develop and maintain.
Practice the basics of lists including creating lists and accessing, inserting, and removing elements from lists.
This lesson is students primary opportunity to get hands on with lists in code prior to the Make activity in the following lesson. Give students as much class time as you can to work through these. For this lesson it's recommended that you place students in pairs as a support and to encourage discussion about the challenges or concepts they're seeing.
CSP Conceptual Framework
AAP-1 - To find specific solutions to generalizable problems, programmers represent and organize data in multiple ways.
AAP-1.D - For data abstraction: a. Develop data abstraction using lists to store multiple elements. b. Explain how the use of data abstraction manages complexity in program code.
AAP-2 - The way statements are sequenced and combined in a program determines the computed result. Programs incorporate iteration and selection constructs to represent repetition and make decisions to handle varied input values.
AAP-2.D - Evaluate expressions that manipulate strings.
AAP-2.N - For list operations: a. Write expressions that use list indexing and list procedures. b. Evaluate expressions that use list indexing and list procedures.
AAP-2.O - For algorithms involving elements of a list: a. Represent using iterative statements to traverse a list. b. Determine the result of an algorithm with list traversals.
CSTA K-12 Computer Science Standards (2017)
AP - Algorithms & Programming
3A-AP-14 - Use lists to simplify solutions, generalizing computational problems instead of repeated use of simple variables.