1/45
Vocabulary flashcards covering foundational computer programming concepts, memory layout, Python syntax, assignment operators, and mathematical functions from Lectures 1 and 2.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
not
Program
A file containing programming language text (such as a .py file) that provides commands and instructions for a computer to follow.
Compiler
A tool that translates an entire computer program into machine instructions at once, creating optimal instructions that are typically saved to a file.
Interpreter
A tool that translates program code line by line, executing instructions immediately as it interprets without saving an intermediate file.
Integrated Development Environment (IDE)
A code editor tied together with a compiler, interpreter, and debuggers to help write, manage, and execute programs (such as VS Code).
Assembly language
A low-level programming language that provides a direct text mapping to binary machine instructions, making it slightly easier to read than binary.
Python
An easy-to-learn, powerful, and flexible programming language named after the British comedy troupe Monty Python.
SymPy
A Python library used in MATH 151 for analytical equation solving that is explicitly prohibited from use in ENGR 102.
Comments
Text in program code beginning with a # character that is ignored by the computer and used to explain logic to human readers.
Floor Division Operator (//)
A built-in Python arithmetic operator that performs division and truncates the remainder
Modulus Operator (%)
A built-in Python arithmetic operator that returns the remainder from division (for example, 7%3=1).
Power Operator (**)
A built-in Python arithmetic operator used for exponentiation (for example, 2∗∗10=1024).
from math import *
A statement placed at the top of a Python program to grant access to standard mathematical functions such as x, sin(x), and cos(x).
Main Memory
The middle tier of computer memory hierarchy, conceptualized as a series of boxes holding information while a program runs.
Variable
A named box of main memory that holds a single unit of information, such as a number or string.
Variable Name
A label used to refer to a specific variable in memory, which must start with a letter or underscore and cannot be a reserved keyword.
Python Keywords
A specific set of 35 reserved commands in Python (such as False, True, None, def, if, and while) that cannot be used as variable names.
Assignment
The process of storing a value into a variable memory box, which overwrites any previous value contained inside that box.
Assignment Operator (=)
An operator in Python that first evaluates the right-hand side expression and then stores the resulting value in the left-hand variable.
Pseudocode
A flexible, precise way to outline problem-solving steps using natural language (English) structured as an action-oriented bulleted list rather than programming code.
Instruction Pointer
A conceptual marker that keeps track of the next instruction scheduled to be executed in a sequential program.
Special Assignment Operators
Shortcut operators such as +=, -=, *=, and /= that perform an arithmetic operation and assign the result in one step (for example, x+=c represents x=x+c).
Console
A window or screen interface that displays text output generated by a running computer program.
print()
A Python function used to display literals, variables, or computed expressions to the console.
Variable x = 10; print(x + 5)
The output of the code will be 15, as the operation adds 5 to the variable x which holds the value 10.
y = 7; z = 3; print(y * z)
The output of the code will be 21, as the operation multiplies variable y (7) by variable z (3).
a = 15; b = 4; print(a // b)
The output of the code will be 3, as the floor division operator (//) divides 15 by 4 and truncates the remainder.
result = 8; result += 2; print(result)
The output of the code will be 10, as the shorthand assignment operator += adds 2 to the result variable, which initially is 8.
num = 12; print(num % 5)
The output of the code will be 2, as the modulus operator (%) returns the remainder of 12 divided by 5.
x = 2; print(x ** 3)
The output of the code will be 8, as the power operator (**) raises 2 to the power of 3.
x = 10; y = 5; z = x * y - 4; print(z)
The output of the code will be 46, as it multiplies x (10) by y (5) to get 50, then subtracts 4.
a = 12; b = 3; c = a - b * 2; print(c)
The output of the code will be 6, as it multiplies b (3) by 2 to get 6, and then subtracts that from a (12).
result = 20; result *= 2 - 5; print(result)
The output of the code will be -60, as it resolves the operation in parentheses first (2 - 5 = -3) and then multiplies result (20) by -3.
num1 = 30; num2 = 10; output = num1 - num2 * 3; print(output)
The output of the code will be 0, as it multiplies num2 (10) by 3 to get 30, then subtracts that from num1 (30).
x = 7; y = 2; z = (x - 3) * y; print(z)
The output of the code will be 8, as it first subtracts 3 from x (7) to get 4, then multiplies by y (2).
val1 = 45; val2 = 10; total = val1 - (val2 * 2); print(total)
The output of the code will be 25, as it first multiplies val2 (10) by 2 to get 20, then subtracts that from val1 (45).
Valid Variable Name Example: my_variable
This name is valid because it starts with a letter, includes letters and underscores, and does not use any reserved keywords.
Invalid Variable Name Example: 2nd_value
This name is invalid because it starts with a number, which is not allowed in Python variable naming conventions.
Valid Variable Name Example: _value
This name is valid because it starts with an underscore and contains only valid characters.
Invalid Variable Name Example: class
This name is invalid as it is a reserved keyword in Python and cannot be used as a variable name.
Valid Variable Name Example: total_sum
This name is valid because it consists of lowercase letters, includes an underscore, and does not use any reserved keywords.
Invalid Variable Name Example: return_value
This name is invalid because it is a reserved keyword in Python and cannot be used as a variable name.
Radians to Degrees Conversion Formula
To convert radians to degrees, multiply by π180. For example, if you have an angle measured in radians as 4π, the conversion to degrees is 4π×π180=45 degrees.
Degrees to Radians Conversion Formula
To convert degrees to radians, multiply by 180π. For example, if you have an angle measured in degrees as 90 degrees, the conversion to radians is 90×180π=2π radians.
Python Function: Convert Degrees to Radians
You can create a Python function to convert degrees to radians as follows:
import math
def degrees_to_radians(degrees):
return degrees * (math.pi / 180)
Python Function: Convert Radians to Degrees
You can create a Python function to convert radians to degrees as follows:
import math
def radians_to_degrees(radians):
return radians * (180 / math.pi)