Podcast
Questions and Answers
A list (or an array) is a variable that can contain more than one piece of information. What is another way to think of a list in these terms?
A list (or an array) is a variable that can contain more than one piece of information. What is another way to think of a list in these terms?
A list can be thought of as a storage location for multiple values.
What is the value of each variable on the different lines of the program?
What is the value of each variable on the different lines of the program?
Line 1: a = 1 Line 2: c = 2 Line 3: b = a + c Line 4: b = 1 Line 5: a = c - b
In order to better understand the difference between a variable and a list, follow the exercise below. What is the difference between a variable and a list?
In order to better understand the difference between a variable and a list, follow the exercise below. What is the difference between a variable and a list?
A variable is a storage location for a single value, while a list is an ordered collection of multiple values.
In a house, we can put up ______. In a building, we can put up ______.
In a house, we can put up ______. In a building, we can put up ______.
A variable containing a piece of information at a time, compared to a building... what does this analogy mean?
A variable containing a piece of information at a time, compared to a building... what does this analogy mean?
In a building, we use the lift buttons to reach the _______.
In a building, we use the lift buttons to reach the _______.
A variable in a list, we use the pointer to access a specific item. In a Small Basic program, that means the variable contains the value 20. In a Small Basic program, what is the value of the third cell of the list contains the value 40.
A variable in a list, we use the pointer to access a specific item. In a Small Basic program, that means the variable contains the value 20. In a Small Basic program, what is the value of the third cell of the list contains the value 40.
Flashcards
List (array)
List (array)
A variable that can hold multiple values simultaneously.
List Element
List Element
A single value stored within a list.
Index
Index
A unique identifier used to access a specific element in a list.
Filling a list
Filling a list
Signup and view all the flashcards
Displaying list content
Displaying list content
Signup and view all the flashcards
Variable
Variable
Signup and view all the flashcards
Indexing a list
Indexing a list
Signup and view all the flashcards
Assigning a value to a variable
Assigning a value to a variable
Signup and view all the flashcards
Program
Program
Signup and view all the flashcards
Code
Code
Signup and view all the flashcards
Lines of code
Lines of code
Signup and view all the flashcards
Variable value
Variable value
Signup and view all the flashcards
Manipulating variables
Manipulating variables
Signup and view all the flashcards
Constant
Constant
Signup and view all the flashcards
Data structure
Data structure
Signup and view all the flashcards
Pointer
Pointer
Signup and view all the flashcards
Element position in a list
Element position in a list
Signup and view all the flashcards
Defining a variable
Defining a variable
Signup and view all the flashcards
Building analogy
Building analogy
Signup and view all the flashcards
Lift button analogy
Lift button analogy
Signup and view all the flashcards
Study Notes
Lists and Variables
- A list (or array) is a variable that holds multiple values simultaneously.
- Variables hold one value at a time.
- Lists are like buildings, while variables are like single houses.
- A variable, like 'a', in a program might hold the value 20.
- A list element (like 'b[3]') in a program might hold the value 40.
- The variable 'a' can store one value (e.g., 20).
- An array, like 'b', contains several ordered values (e.g., b[3] might hold the value 40).
- A list has multiple items and order matters for referencing particular items (e.g., b[3] = 40)
- Variables work like a lift button in a building to reach a particular floor (item).
- Arrays/lists work as a pointer (to access a specific item).
Variable Manipulation
- a = 1
- c = 2
- b = a + c
- b = 1
- a = c - b
Program Structure Example
- In a program, you look at multiple lines to find values held in variables.
- Each line holds a definition or a calculation.
- Lines in the program represent order of operations.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.