Arrays Flashcards
1
Q
What is an array?
A
A data structure that can store a collection of data values all under one name
2
Q
What is each piece of data in an array called?
A
An element
3
Q
What can each element be accessed by?
A
its position (index) in an array
4
Q
What are 1 - Dimensional Arrays like?
A
Lists
5
Q
How do you create an array?
A
array rowers[4] -> number of elements the array can have
rowers[0] = Poo
repeat with 1,2,3
6
Q
How do you retrieve an element from an array?
A
Using the name of the array and the element’s position
e.g. print(rowers[0])
7
Q
How do you change an element in an array?
A
reassign the array position to a different data value
e.g. rowers[0] = Tom