1/23
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Variable
An abstraction inside a program that provides a named memory location to store a value.
Data Types
Types of data that can be held by variables, such as numbers, Booleans, strings, or lists.
Good Variable Names
Descriptive names for variables that enhance code readability, such as score or userName.
Assignment Operator
An operator that allows a program to change the value represented by a variable, denoted by an arrow in pseudocode.
Pseudocode Assignment Syntax
The syntax for assignment in pseudocode is variable ← expression.
Key Rule of Assignment
Assignment in programming is not algebraic; x ← x + 1 means to update x with its current value plus 1.
Swapping Values
A process that uses a temporary variable to swap the values of two variables without loss of data.
Temporary Variable
A variable used to hold a value temporarily during the process of swapping or manipulating data.
MOD Operator
An operator that returns the remainder of division between two numbers.
MOD Example: 10 MOD 3
Evaluates to 1 because 3 goes into 10 three times with a remainder of 1.
Real-World Application of MOD
Used to check if a number is even by evaluating num MOD 2.
Concatenation
The process of joining two or more strings together to form a new string.
String
An ordered sequence of characters enclosed in quotation marks.
List
An ordered collection of elements that can be numbers, strings, or other lists.
Indexing
Accessing items in a list using their position, which in AP CSP starts at 1.
LENGTH Function
Returns the total count of items in a list.
Accessing a List Element
Syntax: list[i] retrieves the value at index i.
Inserting in a List
Shifts items to the right and places a new value at the specified index.
Appending to a List
Adds a value to the very end of a list.
Removing from a List
Deletes an item at a specified index and shifts subsequent items left.
Common Mistake: Assignment Direction
Wrongly assigning with 10 ← score; should be variable ← value.
Zero-Indexing Confusion
Assuming the first item in a list is at index 0, which is incorrect in AP CSP.
Index Out of Bounds
Attempting to access an index outside the limits of a list, which results in an error.
String vs Number Addition
Strings concatenate in operations, e.g., `