1/31
Vocabulary flashcards covering key concepts from the lecture notes on variables, memory, naming, assignment, and sequential steps.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Main Memory
The primary memory where variables live during program execution; part of the memory hierarchy; slower than CPU registers but larger and more persistent.
Memory hierarchy
Organization of memory levels from fastest/smallest to slowest/largest: CPU registers, Cache, Main Memory, Secondary Memory, Offline Memory.
Box metaphor
Main memory is like a collection of memory boxes that hold information used by the program.
Variable
A box of memory that holds a unit of information, such as a number; a named storage location.
Variable name
The label used to refer to a particular memory box; example age.
Python naming rules
Names can start with a letter or underscore, may contain letters, numbers, underscores, and cannot be a reserved keyword.
Python keywords
Reserved words in Python with special meaning, such as False, True, None, and, as, assert, break, class, continue, def, del, etc.
Reserved keyword
A word reserved by the language for its syntax and not allowed as an identifier.
Naming conventions
Desirable to use descriptive, readable names; constants often ALL_CAPS; variables usually start with lowercase; common prefixes for indexing like i, j, k.
Descriptive naming example
Volumeofthesphere is descriptive; shorter alternatives like Vsphere or Vsphere may be used.
Problem to software mapping
Process of translating a real world problem into software by identifying questions to answer and data to represent.
Payoff_time naming
A descriptive name for time to payoff, with variations like payofftime or payofftime_months for units.
Assignment
The process of putting a value into a memory box, replacing the old value.
Assignment statement
Python statement of the form a = b; first the right-hand side is evaluated, then the value is stored in the left-hand side.
Left-hand side (LHS)
The variable name that will hold the assigned value.
Right-hand side (RHS)
The value or expression that is evaluated to produce the value to store.
Evaluation order
In an assignment, the RHS is evaluated before updating the LHS.
Z = X + 1 example
Compute the value of X, add 1, then store the result in Z.
Sequential steps
A sequence of instructions executed in a specific order; essential for programming and solving problems.
Pseudocode
A flexible, natural language style for expressing steps before coding; focuses on procedure rather than details.
Pseudocode guidelines
Be clear, concise, use one action per line, use bullets, avoid code, start with high level steps.
Quadratic pseudocode
Pseudocode steps to solve a quadratic equation by setting coefficients, computing discriminant and roots, then displaying results.
Special assignment operators
Operators like +=, -=, *=, /= that modify the left-hand variable by the value on the right.
Output/print
Basic output to the console; print(x) displays the value of x, where x can be a literal, a variable, or an expression.
Order of operations
Standard precedence: multiplication and division before addition and subtraction; parentheses can change grouping.
Instruction pointer
Concept indicating the next instruction to execute when stepping through a sequence of statements.
Assignment sequences
Multiple assignments in order; tracking how each statement changes variable values.
3 variable example PI r volume
Example sequence: PI = 3.14159, r = 5.3, volume = PI * r * r * r * (4/3) demonstrating sequential assignments.
Self referential assignment
Assigning a variable using its current value, such as z = z + 1, which uses the old value on the RHS and updates the LHS.
Output example note
Using print to verify computations by displaying results or intermediate values.
Const vs variable naming
Constants are values that do not change; by convention named in ALL_CAPS to distinguish from regular variables.
Single variable placeholder
A variable name acts as a placeholder for its stored value in expressions, such as age in age + 3.