1/104
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Input
A program recieves data from a variety of types
Process
A program performs computations on input data
Output
A program puts the data somewhere
Program
Consists of instructions executing one at a time
Algorithm
A sequence of instructions that solve a problem
Interpreter
A program that executes computer code
Code
The text that represents a computer program
Statement
A program instruction. A program mostly consists of a series of instructions usually with each one appearing on it’s own line
Expression
A piece of code that the interpeter evaluates to produce a value such as a number
Variable
A named reference to a value stored by the interpreter, like wage, hours, weeks.
Print() Function
Function that displays variables or the result of expressions
String
Text enclosed in quotes, these may have letters, spaces or symbols
Newline Character
Output can be moved to the next line by using \n
input() Function
Function that is used to read input from a user
Type
Determines how a value can behave
int() Function
Function used to convert string to a integer
syntax error
Error that violates a programming language’s rules on how symbols can be combined to create a program
runtime error
Error in which a program’s syntax is correct but the program attempts an impossible operation
indentation error
Error when lines of the program are not properly indented
value error
Error when an invalid value is used, which can occur if giving letters to int()
name error
Error when the program tries to use a variable that does not exist
type error
Error when an operation uses incorrect types, which can occur if adding an integer to a string
Integrated Development Enviorment (IDE)
Software that integrates a text editor and a python interpeter, often with additional tools
Console (Terminal)
A text based interface that allows a user to run programs, enter programs, enter input, and view a program output
Object
Represents a value and is automatically created by the interpreter when executing a line of code
type() Function
Function that returns the type of an object
Mutability
Whether an object’s value can be changed after it is created
Immutable
An object value cannot be changed after it is created, this includes strings and integers
id() Function
Function that gives the value of an object’s identity
float() Function
Function that converts an integer or a numeric string into a floating point number, which can contain decimals
overflow error
Error that occurs when a value is too large to be stored in the memory allocated by the interpreter
NotImplementedError
Error that occurs to immediately stop a program if an unfinished function get called
Operator
A symbol that performs a built in calculation (-, +, , /, **)
Compound Operators
Special operator that provide a shortcut way to update a variable (+=, -=, /=, *=, %=)
Floor Division Operator : //
Special operator that can be used to round down the result of a floating point division to the closest smaller whole number value.
Modulo Operator : %
Special operator that can be used to evaluate the remainder of the division of two integer operands
Script
A file containing python code that is passed as input to the interpreter
random() Function
Function that returns a random floating point value each time the function is called
randrange() Function
Function that generates random integers within a specified range
Escape Sequence
A backslash followed by a character that represents a special character (\n for a new line, \t for a tab)
ord() Function
Function returns an encoded integer value for a string of length one
chr()
Function returns a string of one character for an encoded integer
String literal
String defined in the source code of a program by surrounding the text value with single or double quotes
len Function
Function can be used to find the length of a string
String Indexing
One can use brackets ([]) to reference a character at a specific index
String Concatenation
The process of joining strings together using the + operator to generate a new string. Non-string values must be converted using str() first to prevent errors.
List = [x,y,z]
A mutable, ordered collection of items that can hold elements of various data types
Index
An integer that specifies the position of an element within a list
Container
A data structure that holds and organizes multiple elements, allowing for easy storage and retrieval
Element
An individual item stored within a list
Method
Instructs an object to perform an action. Written using the object name, a dot . symbol, and the instuction name
.append()
List method that is used to add new elements to a list
.pop()
List method that is used to remove the element at index i from a list
.remove(v)
List method that is used to remove the first element whose values matches
Tuple = (x,y,z)
Stores a collection of data, like a list but is immutable, so elements cannot be changed
Set = {x,y,z}
An unordered collection of unique elements, with this elements located here do not have a position or index and no elements share the same value
set() Function
Function that accepts a sequence type iterable object (list, string, tuple, etc.) whose elements are inserted into a set (immutable)
Set literal
A sequence of unique values enclosed in curly braces {}. The sets are unordered and automatically remove duplicate elements.
Dictionary = {x:y}
Stores an associative collection of key-value pairs. Keys must be immutable (like strings, numbers, or tuples), while values can be any data type
Branch
A sequence of statements only executed under a certain condition
if Branch
Type of branch taken only “if an expression is true
if-else Branch
Type of branch where first branch is executed “if an expression is true, “else” the other branch is executed
if-else-else Branch
An if-else branch can be extended, each expression is checked in sequence until one branch is found to be true
Equality Operator (==)
Special operator that evaluates to true if the left and right side are equal
Inequality Operator (!=)
Special operator that evaluates to ture if the left and right sides are not equal, or different
Boolean
A data type that has only two possible values; True or False
elif
A keyword meaning "else if" for adding extra branches. Expressions are checked in sequence: the first true branch executes (skipping the rest), and if none are true, the else branch executes
Relational Operator
Special operators that check how one operand’s value relates to another (<, >, <=, >=)
Operator Chaining
Performs multi comparisons and evaluates it left to right (a<b<c)
Logical Operator
Treats operands as being true or false. This includes AND, OR, and NOT. (AND: True when both of its operands are true) (OR: True when at least one of its two operands are true) (NOT: True when its one operand is False, and vice versa)
Nested if-else
An if-else statement placed inside another if or else branch, allowing for multi-level conditions where inner checks only run if outer conditions are met
Membership Operators
Includes the “in” and “not in” operator, which yield true or false if the left operand matches the value of an element in the right operand which is always a container
Identity Operators
Includes the “is” and “is not” operators, which yield True or False depending on whether two operands reference the exact same object in memory rather than comparing their values
Code Block
Series of statements grouped together, defined by it’s indentation level
Loop
A block of code that keeps repeating its instructions as long as a condition is true, and stops once that condition turns false. Running through the code one time is called an iteration
While Loop
Repeatedly runs a block of code as long as its condition is true, stopping once the condition becomes false. Each execution of the loop is called an iteration
Sentinel Value
A value that causes a loop to end
randint() Function
Function that provides a new random number each time the function is called
Loop Variable
A variable updated during each iteration to track or count progress until the loop condition becomes False. Forgetting to update it can cause an infinite loop
for loop
Goes through a collection (like a list, string, or dictionary) one item at a time, assigning each item to a variable so you can work with it in the loop body
range() Function
Generates a sequence of numbers starting from a start value up to (but not including) an end value, stepping by a set amount. To include the ending number, add +1 to the end value
For Loop vs While Loop
Use a for loop when you know in advance how many times to repeat (or when iterating over a fixed collection), and use a while loop when you don't know the number of loops and need to repeat until a specific condition becomes false
Nested loop
A loop that appears as part of the body of another loop. These are commonly recalled as outer and inner loop
Break
A statement in a loop that causes the loop to exist immediately. It can sometimes yield a loop that is easier to understand
Continue
A statement in a loop that causes an immediate jump to the while or for loop header statement. It can help improve readability of a loop
Loop else
A block of code attached to a loop that executes only after the loop completes all its iterations naturally (without hitting a break statement)
enumerate() Function
Function retrieves both the index and corresponding element value at the same time, providing a cleaner solution
Unpacking
Splitting elements from a sequence (like a tuple or list) into multiple individual variables all at once in a single step
def
A keyword that is used to create new functions
Return Statement
Allows for a function to return one value
Void Function
A function with no return statement and such a function returns the value “None”
Parameter
A function input specified in a function definition
Argument
A value provided to a function’s parameter during a function call
Polymorphism
When an operator or function changes how it works depending on the kind of data you give it
Dynamic Typing
Used by Python to automatically determine a variable's data type while the program runs, allowing its type to change whenever you assign it a new kind of value
Modular Development
The process of dividing a program into separate modules that can be developed and test separately and integrated into a single program
Pass
A keyword that performs no operation except to act as a placeholder for a required statement((
Function Stubs
Placeholder functions with no real code inside yet, used to outline how a program will work before writing the full details
Bytecode
A simplified version of your code created behind the scenes by Python so the computer can process and run it faster
Scope
The specific region of code where a variable is created and can be accessed such as inside a function (local) or across the entire file (global)