Units 2 and 3 Vocabulary
- Material That Has Been Covered
- Unit 2 Binary/Data Terms and Unit 3 Algorithm/Programming Terms
- Variables
- Data Types
- Assignment Operators
- Lists
- 2D Lists
- Dictionaries
- Algorithms
- Expressions
- Comparison Operators
- Boolean Expressions and Selection/Iteration
- Truth Tables
- AND truth tables
- OR truth tables
- XOR truth tables
- Bits
- Bytes
- Hexadecimal / Nibbles
- Binary Numbers
- Unsigned Integer
- Signed Integer
- Floating Point
- Binary Data Abstractions
- Boolean
- ASCII
- Unicode
- RGB
- Data Compression
- Lossy
- Lossless
- Class
- Characters
- Strings
- Length
- Concatenation
- Upper
- Lower
- Traversing Strings
- Python If, Elif, Else conditionals
- Nested Selection Statements
- Python For While loops with Range with List
- Combining loops with conditionals to Break, Continue
- Procedural Abstraction
- Python Def procedures
- Parameters
- Return Values
Material That Has Been Covered
See Daily Notebooks and Hacks for More Help on Any Of These Topics!
- Variables, Assignments, and Data Abstractions
- Mathematical Expressions and Strings
- Boolean Expression, Conditionals, and Nested Conditionals
- Boolean Iteration and Lists
- Developing Algorithms and Binary Search
- Calling and Developing Procedures
a value that can change, depending on conditions or on information passed to the program.
fruit = "apple" #fruit is the name, 'apple' is the value, and string is the type
score = 0 #score is the name, 0 is the value, integer is the type
- String (or str or text) - combination of any characters
- Character (or char) - single letters
- Integer (or int) - whole numbers
- Float (or Real) - numbers that contain decimal points, or for fractions.
- Boolean (or bool) - data is restricted to True/False or yes/no options
integer = 9
string = "words" #surrounded by quotations
boolean = False # True or false
operator used to assign a new value to a variable.
Operator | Description | Syntax | Outcome when print(a) |
---|---|---|---|
= | Assign value of right side of expression to left side operand | a = b | b |
+= | Add right side operand with left side operand and then assign to left operand | a += b | a + b |
-= | Subtract right operand from left operand and then assign to left operand: True if both operands are equal | a -= b | a - b |
*= | Multiply right operand with left operand and then assign to left operand | a *= b | a * b |
/= | Divide left operand with right operand and then assign to left operand | a /= b | a / b |
**= | Calculate exponent(raise power) value using operands and assign value to left operand | a **= b | a ^ b |
an abstract data type that represents a finite number of ordered values, where the same value may occur more than once.
fruits = ["apple", "grape", "strawberry"]
print (fruits)
a two-dimensional array can hold more than one set of data
keyboard = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [" ", 0, " "]]
def print_matrix4(matrix):
for i in matrix:
print('\t'.join(map(str, i)))
print_matrix4(keyboard)
an abstract data type that defines an unordered collection of data as a set of key-value pairs
quiz = {"Who is the author of It Ends With Us":["a. Holly Jackson","b. Colleen Hoover", "c. Lisa Jewell", "d. Jennifer Barnes"], "Who is the author of Percy Jackson":["a. JK Rowling", "b. Holly Jackson","c. Rick Riordan", "d. Colleen Hoover"]
, "When was a Good Girl's Guide to Murder Published":["a. 2019","b. 2018", "c. 2020", "d. 2021"], "When was It Starts with Us Published":["a. 2019","b. 2020", "c. 2021", "d. 2022"]}
# for the answers, used the question as the key and the multiple choice letter as the value
answers = {"Who is the author of It Ends With Us":"b", "Who is the author of Percy Jackson":"c", "When was a Good Girl's Guide to Murder Published":"a", "When was It Starts with Us Published":"d"}
count = 0
# iterating through the dictonary's keys and values
for k,v in quiz.items():
# printing the key and it's values
print(k)
print(*v, sep = '\n')
# taking the user input for the answer, entering ab
user_input = input("Enter Your Answer")
# comparing that with the answer's value
if(answers.get(k)==user_input):
# incrementing the count
count = count +1
# printing the user's score
print('You got', count, 'correct answers')
- a list set of instructions, used to solve problems or perform tasks.
- Sequence: algorithms do tasks in the order of specification.
- Selection: helps choose two different outcomes based off a decision.
- Iteration: if a condition is true, then the code can repeat.
combination of values and functions that are combined and interpreted to create a new value.
- x + y Addition
- x - y Subtraction
- x * y Multiplication
- x / y Division
- x // y Quotient
- x % y Remainder
- x ** y Exponentiation
compares two values against one another.
- a = b - equal to
- a (not equal to symbol) b - not equal to
- a > b - greater than
- a < b - less than
- a (is greater than or equal to symbol) b - greater than or equal to
- a (is less than or equal to symbol) b - less than or equal to
if a condition is true or false, there is a differnet outcome and if a condition is true, the code repeats an earlier step.
num = 5
# selection:
if num < 100 :
print("The number is small")
else:
print ("The number is large")
# iteration:
while num < 10:
num = num + 1
print(num)
- have two values
- 0 = off, false
- 1 = on, true
- Examples
- 0 and 0 = false. And operator means both needs to be true.
- 0 or 1 = true. Either or.
- Use this in conditionals (selection).
- AND = Both A AND B must be true for the overall operation to be true
- XOR = Either A OR B must be true for the overall operation to be true, except if both are true then the overall outcome is F again
- Or = Either A OR B must be true for the overall operation to be true
Ex: A is true, B is false
most basic unit of informartion in computing.
binary digit that is the smallest increment of data on a computer ex. 0 and 1
a group of 8 digits or bits operating as one unit.
ex. 12,345,678
base/positional number system used in mathematics and computer science (base 16 numbering system)
a binary digit, or bit, is the smallest unit of data. numbers expressed in the base two numbering systems. they are only 0s and 1s.
non-negative integers.
integers that don't have a sign associated with them
- ex. 1, 2
32-bit datum, encodes an integer in the range ([-2147483648 to 2147483647]).
A signed integer is a 32-bit datum that encodes an integer in the range [-2147483648 to 2147483647]
- ex - 100, 80
a positive or negative whole number with a decimal point.
examples: 5.2, 333.09, etc.
reducing data to simplify it's entirety.
logical data type that can have only the values true or false.
brands = ["nike", "adidas", "underarmour"] #string
numbers = [1, 2, 3, 4, 5] #integer
truefalse = [True, False, True] #boolean
a character encoding scheme in which each character is represented by a 7-bit (originally) or 8-bit binary sequence.
16-bit character set which describes all of the keyboard characters.
- ex: emojis
a problem solving approach (algorithm) to find a satisfactory solution where finding an optimal or exact solution is impractical or impossible.
the process of encoding data so that is needs fewer bits/bytes to represent it.
data encoding and compression technique that deliberately discards some data in the compression process.
data compression algorithm that allows the original data to be perfectly reconstructed from the compressed data
x = True
y = False
written in a defined structure to create an object.
class MyClass:
x = 5
display unit of information equivalent to one alphabetic letter or symbol.
- ex: ex. a, 8, #
ordered sequences of characters.
string = "hello"
len ()
len("supercalifragilisticexpialidocious")
the number of symbols output.
String concatenation is combining 2 or more strings to make a new strings in order to create a new string
concat() in pseudocode and varys from language to language can be used to combine to strings such as concat("cookie","monster") returns cookiemonster
string1 = "book"
string2 = "case"
used to check if the argument contains any uppercase characters.
- returns "True" if all characters in the string are uppercase, Otherwise, It returns "False".
returns the lowercase string from the given string.
the process of going through a String one character at a time, often using loops.
- If: statement executes a piece of code when one statement is false and the following statement is true.
- Elif: first if statement isn't true, but want to check for another condition.
- Else: executes if "if" isn't true.
hours = 30
sal = ""
experienced = True
# using operators to determine the salary
if (hours >= 10):
sal = "150k"
elif (hours >= 8):
sal = "90k"
else:
sal = "50k"
experienced = False
# printing the final statement
print ('The person has a salary of:' , sal,'and has experience:' , experienced)
when more than one decision must be made before the appropriate action can be taken.
returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number.
- For: Process stops if next element meets statement
- While: Process is repeated until statement is met
a statement that controls the flow of execution depending on some condition.
have variable parameters.
procedure allows us to group a block of code under a name, known as a procedure name.
variable used in a function to refer to one of the pieces of data provided as input to the function.
function returns to the calling script or function when it completes its task.