WorksheetsCode.org Unit 6 - Lists
Total questions: 12
Worksheet time: 6mins
An ordered collection of elements.
Sequence
List
Length
Element
An individual value in a list that is assigned a unique index.
Sequence
List
Length
Element
A common method for referencing the elements in a list or string using numbers.
Sequence
List
Index
Element
Refers to the entire length of a list.
[list].length
[list].length-1
A way to reference the last item in a list.
[list].length
[list].length-1
Allows a user to see random elements in a list that generate a random number between 0 and the length of the list minus one.
Random List Access Pattern
Scrolling List Pattern
List Length
appendItem
Allows a user to "scroll" through all the items in the list.
Random List Access Pattern
Scrolling List Pattern
List Length
appendItem
Removes the element in the given list at the given index.
removeItem(list, index)
appendItem(list, item)
insertItem(list, index, item)
list.length-1
Adds an element to the end of the list.
removeItem(list, index)
appendItem(list, item)
insertItem(list, index, item)
list.length-1
Inserts an element into a list at the index given.
removeItem(list, index)
appendItem(list, item)
insertItem(list, index, item)
list.length-1
What does this code check in the conditional?
if index is less than the length of the list
if index is less than the last item in the list
What is this list pattern is this picture an example of?
Random Access List Pattern
Scrolling List Pattern
