College Board Vocab
Unit 2… Binary/Data Terms
- Bits, Bytes, Hexadecimal / Nibbles:
- Bits: the smallest unit of data in a computer, used to represent a boolean value
- Bytes: unit of data that is typically made up of 8 bits, used to represent a single character or symbol in a computer’s memory
- Hexadecimal: a numeral system that uses base 16, used in computing as a way to represent binary data in a more compact and human-readable form
- Nibbles: a unit of data that is made up of 4 bits, used to represent a single hexadecimal digit
- Binary Numbers: Unsigned Integer, Signed Integer, Floating Point:
- Unsigned Integer: a positive whole number that can range from 0 to infinity that is determined by the number of bits used to represent the integer
- Signed Integer: can represent both positive and negative whole numbers
- Floating Point: a data type that represents a decimal number
- Binary Data Abstractions: Boolean, ASCII, Unicode, RGB:
- Boolean: a data type that has only two possible values, true or false
- ASCII: a standardized character encoding that represents letters, numbers, and other symbols in computers; represent text in computers
- Unicode: a standardized character encoding that represents most of the world’s written languages; includes ASCII and many other characters from different scripts and languages
- RGB: a color model used to represent colors in devices; combination of these three colors in different proportions creates a wide range of colors
- Data Compression: Lossy, Lossless:
- Lossy: involves discarding some of the data in the original file in order to reduce its size; used for audio, video, and image files, where some loss of quality is acceptable in exchange for a smaller file size
- Lossless: involves encoding the data in such a way that all of the original information can be recovered when the file is decompressed; used for text, software, and other types of data where it is important to preserve all of the original information
- Variables, Data Types, Assignment Operators:
- Variables: used to store and manipulate data in a program
x = 10
- Data Types: classification of data based on the type of value it can hold; include integers, floating-point numbers, characters, and strings
x = 10 y = "Hello" Nums = [1,3,4,6]
- Assignment Operators: a symbol that is used to assign a value to a variable (=)
- Variables: used to store and manipulate data in a program
- Managing Complexity with Variables: Lists, 2D Lists, Dictionaries, Class:
- Lists: an ordered collection of items with square brackets ([])
my_list = [1, 2, 3, 4, 5] mixed = [1, 'hello', 3.14, True] words = ['apple', 'banana', 'cherry']
- 2D Lists: also called a matrix, a list of lists
matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
- Dictionaries: collection of key-value pairs, uses curly braces ({})
dictionary = {'one': 1, 'two': 2, 'three': 3}
- Class: a blueprint for creating objects, they have member variables and have behavior associated with them
- Lists: an ordered collection of items with square brackets ([])
- Algorithms, Sequence, Selection, Iteration:
- Algorithms: a set of steps or instructions that are followed to solve a problem or perform a task
- Sequences: executes a series of steps in a specific order
print(x) print(y) print("Hi")
- Selection: executes one or more steps based on a specific condition
if x > 0: print("x is positive") elif x < 0: print("x is negative") else: print("x is 0")
- Iteration: executes one or more steps repeatedly until a certain condition is met
x = 10 while x > 0: print(x) x -= 1
- Expressions, Comparison Operators, Booleans Expressions and Selection, Booleans Expressions and Iteration, Truth Tables:
- Expressions: combination of values, variables, and operators that results in a single value
- Comparison Operators: compare values and determine if they are equal, greater than, or less than each other
- ”==”: equal to
- ”!=”: not equal to
- ”>”: greater than
- ”<”: less than
- ”>=”: greater than or equal to
- ”<=”: less than or equal to
x = 4 y = 5 print(x == y) print(x != y) print(x > y) print(x < y) print(x >= y) print(x <= y)
- Boolean Expressions and Selection: a boolean variable (True/False) can be used as conditions in selection (if statements)
- Boolean Expressions and Iteration: iteration (while loops) can use a boolean variable as a condition(if statements)
- Truth Tables: A table for a logical operator containing each variable and all possible input and output results of that operator
- AND: all inputs must return true
- OR: one input must return true
- XOR: only one input can be true
- Characters, Strings, Length, Concatenation, Upper, Lower, Traversing Strings:
- Characters: a single letter, number, symbol, or other element
- Strings: sequence of characters
name = "Kaiden"
- Length: number of characters it contains
name = "Kaiden" print(len(name))
- Concatenation: combining two or more strings into a single string
name = "Kaiden" lastName = "Do" concatenated = name + " " + lastName
- Upper: convert a string to all uppercase
name = "Kaiden" print(name.upper())
- Lower: convert a string to all lowercase
name = "Kaiden" print(name.lower())
- Traversing Strings: to access each character in the string one by one, use a for loop to do this
name = "Kaiden" for x in name: print(x)
- Python If, Elif, Else conditionals; Nested Selection Statements:
- Python If: execute a block of code if a specific condition is true
if x > 0: print("Hi")
- Elif: to specify additional conditions to check if the previous conditions are false
if x > 0: print("Hi") elif x > -10: print("Bye")
- Else conditionals: execute a block of code if all of the previous conditions are false
if x > 0: print("Hi") elif x > -10: print("Bye") else: print("NO NO NO")
- Nested Selection Statements: control structures that contain other control structures within them
if x > 0: if b > 0: print("x and b are positive")
- Python If: execute a block of code if a specific condition is true
- Python For, While loops with Range, with List:
- Python For: used to execute a block of code multiple times
for i in range(1, 6): print(i)
- While loops with Range: execute a block of code repeatedly until a certain condition is met
x = 0 while x <= 5: print(x) x += 1
- with List:
x = [4,3,5,2,1] i = 0 while i <= len(x): print(x[i]) i += 1
- Python For: used to execute a block of code multiple times
- Combining loops with conditionals to Break, Continue:
- Combining loops with conditionals to Break: break is used to exit a loop early
- Continue: used to skip the rest of the current iteration and move on to the next one
while y > 0: if x == 0: break if x == 3: continue
- Procedural Abstraction, Python Def procedures, Parameters, Return Values:
- Procedural Abstraction: abstract away the details of how the task is performed, making your code easier to read and maintain, more efficient code
- Python Def procedures: how procedures are made with the def word
def Greeting(name): print("Hello", name) Greeting("Kaiden")
- Parameters: values that are passed to the procedure when it is called, defined within the parentheses of the procedure definition
def Sum(x,y): print(x+y) Sum(6,8)
- Return Values: value that is returned can be used by the calling code to perform additional tasks or to assign to a variable
def subtract(x,y): diff = x - y return diff print(subtract(5,2))