click below
click below
Normal Size Small Size show me how
PCEP Unit 3
| Term | Definition |
|---|---|
| Programmer | Someone who creates code and programs. |
| Computer | Device capable of performing calculations, storing data, and communicating with other computers. |
| Program | A set of computer code in a programming language that can process and output data. |
| True | One of the two acceptable computer answers, represented by binary 1, or on. |
| False | One of the two acceptable computer answers, represented by binary 0, or off. |
| left-sided binding | The order of processing that processes information that is on the left side before the information on the right side. An example would be addition (1+2=3). |
| right-sided binding | The order of processing that processes information that is on the right side before the information on the left side. An example would be exponentiation (2**3=8). |
| == | Comparison operator that asks, "Are these two values equal to each other?" |
| != | Comparison operator that asks, "Are these two values not equal to each other?" |
| > | Comparison operator that asks, "Is the value on the left greater than the value on the right?" You may remember this like a crescendo, with the bigger gap side on the left. |
| >= | Comparison operator that asks, "Is the value on the left greater than or equal to the value on the right?" Like > but with an equal sign under it. |
| < | Comparison operator that asks, "Is the value on the left less than the value on the right?" You may remember this like a decrescendo, with the bigger gap side on the right. |
| <= | Comparison operator that asks, "Is the value on the left less than or equal to the value on the right?" Like < but with an equal sign under it. |
| Conditional statement | A statement that runs based on the condition of a statement. This includes if and while statements. |
| The if statement | A statement that runs either once or not at all, depending if a condition is true or false. |
| Indentation | A spacing technique used to differentiate various hierarchies and levels within loops or functions. |
| The truth (how python interprets values in conditional statements) | If a condition is equal to 0, or nothing, then it is registered as False. If it is non-zero, then it is registered as True. |
| Omission | Leaving out an else or elif block when it’s not needed; Python allows if without else. |
| else statement | A block that runs only if the if (or elif) condition is False; it’s the “otherwise” part of a decision. |
| Nesting | Putting one control structure (like if or for) inside another, creating inner and outer blocks. |
| The elif statement | Short for “else if”; another condition checked only if previous if/elif conditions were False. |
| Cascade | A chain of if/elif/elif/.../else statements that check conditions in order until one is True. |
| Pseudocode | A plain-English outline of an algorithm, written like code but not in any real programming language. |
| Algorithm | A step-by-step procedure for solving a problem, written so a computer (or person) can follow it. |
| Loop | A piece of code that repeats multiple times while a condition is True or over a sequence. |
| while | A loop that repeats as long as a given condition stays True. |
| The loop’s body | The indented block of code that runs each time the loop repeats. |
| An infinite loop | A loop whose condition never becomes False, so it runs forever unless interrupted. |
| KeyboardInterrupt | The error that happens when you stop a running program manually (like pressing Ctrl+C). |
| for loop | A loop that repeats a set number of times or once for each item in a sequence. |
| Control variable (in the for loop) | The variable that takes each value from the sequence (like i in for i in range(5)). |
| range() | A function that generates a sequence of numbers for a for loop to iterate over. |
| Pass | A keyword that does nothing; it’s a placeholder when Python requires a statement but you don’t want to do anything yet. |
| 0-based counting | The rule that the first element in a list is at index 0, the second at index 1, and so on. Also applies to the range() function, where the first value generated(by default) is 0. |
| Start | The first number in a range() call; where counting begins (default is 0 if omitted). |
| Stop | The number in range() where counting stops before reaching (the range goes up to but not including this). |
| Step | The amount to increase (or decrease) by each time in range(); default is 1 if omitted. |
| Ascending order | Order from smallest to largest, like 1, 2, 3, 4. |
| Syntactic candy/sugar | Syntax shortcuts that make code nicer to read but don’t add new power, like a+=1 instead of a=a+1. |
| Break | A statement that immediately stops the loop it’s in and jumps to the code after the loop. |
| Continue | A statement that skips the rest of the current loop iteration and jumps to the next iteration. |
| Keywords | Special reserved words in Python (like if, for, while) that have fixed meanings and can’t be used as variable names. |
| And | A logical operator that is True only if both sides are True; otherwise it’s False. |
| Or | A logical operator that is True if at least one side is True; it’s False only if both sides are False. |
| Not | A logical operator that flips True to False and False to True. |
| binary | A number system using only 0 and 1; how computers store and process numbers internally. |
| & | A bitwise AND operator that compares each bit of two numbers and returns 1 only where both bits are 1. |
| | | A bitwise OR operator that compares each bit of two numbers and returns 1 where at least one bit is 1. |
| ~ | A bitwise NOT operator that flips every bit of a number (0 becomes 1, 1 becomes 0). |
| ^ | A bitwise XOR operator that returns 1 where the bits are different and 0 where they are the same. |
| Mask | A binary pattern used with bitwise operators to select, set, or clear specific bits in a number. |
| Set | To force a particular bit to 1 using a bitwise operation, often with OR and a mask. |
| Reset | To force a particular bit to 0 using a bitwise operation, often with AND and a negated mask. |
| Check | To test whether a particular bit is 1 or 0 using a bitwise AND and a mask. |
| Negate | To flip all bits in a number using ~, or more generally to take the opposite logical value. |
| Binary right shifting | Moving all bits in a number to the right by some places, which divides the number by powers of 2. |
| Binary left shifting | Moving all bits in a number to the left by some places, which multiplies the number by powers of 2. |
| Lists | Ordered collections of items in Python, written inside square brackets like [1, 2, 3]. |
| List scalar | A single item (element) inside a list, like 1 in [1, 2, 3]. |
| list indexing (list[0]) | Accessing a single element in a list by its position number inside square brackets. |
| len() | A function that returns the number of elements in a list (or other sequence). |
| Del | A statement that removes an item from a list by its index, like del my_list[2]. |
| Slice | A way to take a part of a list using [start:stop:step], creating a new smaller list. |
| Slice start | The first index in a slice; the place where the slice begins (inclusive). |
| Slice stop | The index where the slice ends (exclusive; the slice goes up to but not including this). |
| Slice step | The amount to jump between indices in a slice; default is 1 if omitted. |
| Negative indices | Index numbers that count from the end of the list, like -1 for the last element. |
| Methods | Functions that belong to an object and are called with a dot, like my_list.append(5). |
| .append() | A list method that adds one new item to the end of the list. |
| .insert | A list method that adds an item at a specific position, like my_list.insert(1, 10). |
| Iterating through the scalars of a list | Using a loop to go through each element of a list one by one, like for x in my_list. |
| Bubble sort | A simple sorting algorithm that repeatedly swaps neighboring elements if they’re in the wrong order until the list is sorted. |
| How to “copy” a list (using slices) | Making a new list with the same elements using a full slice like new_list = old_list[:]. |
| in operator | An operator that checks if a value exists inside a list or other sequence and returns True or False. |
| not in operator | An operator that checks if a value does NOT exist inside a list or other sequence and returns True or False. |
| arrays | Lists inside of a lists, forms a structure similar to a graph, however, can be expanded to include any amount of dimensions you wish. |