Essential Knowledge
A variable is an abstraction that stores a value inside of a program, and each variable has a corresponding data storage that only ever stores one value at a time.
Most variables have meaningful names that aid in the general structure of the code and the comprehension of what the variables are meant to represent.
Variables like Booleans, numbers, lists, and strings) are used to refer to data that is represented in a variety of ways by some programming languages.
Variable
Data Types
integers (number)
string (text)
boolean (true/false)
Lists
The elements within the list can be accessed by index
Can store various elements
The list is in order
Lesson 3.3.1
A sequence is the order in which something should be done in order to reach a goal, much as how you would follow a teacher’s directions.
If your car runs out of fuel, you go to the gas station to fill it up, but if your car is full, you wouldn’t go to the gas station. A selection allows an algorithm to make a decision based on whether a condition is met.
iterations make allows an algorithm to make a decision in code
Lesson 3.4
String :
Characters in sequential order
There may be some processes that can be applied to strings.
Every language has its own conventions, techniques, and capabilities.
Remainder:
The order of operations for division and multiplication is the same for operators with MOD. The syntax of MOD in Python and the majority of computer languages is %
Lesson 3.5
a Boolean is a denoting a system of algebraic notation used to represent logical propositions, especially in computing and electronics.
Testing if two numbers or variables are equal is a common example.
Relational Operators
NOT, it displays the opposite of whatever the data is. Mainly used for true/false, and does not effect the variable.
AND, used to evaluate two conditions together and determine if both conditions are met
OR, when using or the function only looks to see if one of the conditions is met then will
Lesson 3.7
Nested conditional statements consist of conditional statements within conditional statements
Can be used for a varying amount of “else if statements.” The first if statement can represent if two conditions are true. The first else if can represent if only one or the other is true. The last else if represents if neither of the conditions are true.
Lesson 3.8
Iteration: a repeating portion of an algorithm, repeats a specified number of times or until a given condition is met
use stopping conditions to stop an iteration if a condition is already met
Iteration Statement - cause statements to be executed zero or more times, subject to some loop-termination criteria
Lesson 3.3.8
Lesson 3.10
Traversing Lists: where all elements in the list are accessed, or a partial traversal, where only a portion of elements are accessed (can be a complete traversal)
List procedures are implemented in accordance with the syntax rules of the programming language
Lesson 3.10.1
Since CS is taught in different languages the pseudo code represents fundamental programming concepts.
A given element of a list can be evaluated using index, [ ]
Lesson 3.9.1
Main Idea 1: Algorithms can be written in different ways and still do the same thing
However, Algorithms that look similar might not always have the same result
Different algorithms can be used to solve the same problem
When collaborating or working on group projects, two people might come up with two different ways to solve a problem, and that happens a lot.
Nested Conditionals as Boolean expressions
Lesson 3.9.2
Developing Algorithms
When creating an algorithm, its good to outline its process before coding
This ensures that it is sequenced correctly
You should represent the algorithm using a flowchart or natural language
Visualization can help you better see the flow of the whole algorithm
This may allow for the coding process to be more efficient and effective
Lesson 3.9.3
Knowing existing algorithms can help construct new ones
simple existing algorithms can include
determining min or max of two or more numbers
computing the sum or average
identifying if an integer is even or odd
Lesson 3.11
Middle number in an index or list is found by taking the highest index number plus the lowest index number and divide by 2
Binary trees are used to showcase this
objective: To be able to select appropriate libraries and/or existing code to use in the creation of new programs.
A library is a collection of code from an external source that can be used to add functionality to a program.
The import function imports a python library, which allows the user to code using pre made functions such as pow, sqrt, or even factorial.
Some other libraries that the user can import include
seed() | Initialize the random number generator |
getstate() | Returns the current internal state of the random number generator |
setstate() | Restores the internal state of the random number generator |
getrandbits() | Returns a number representing the random bits |
randrange() | Returns a random number between the given range |
randint() | Returns a random number between the given range |
choice() | Returns a random element from the given sequence |
choices() | Returns a list with a random selection from the given sequence |
shuffle() | Takes a sequence and returns the sequence in a random order |
sample() | Returns a given sample of a sequence |
random() | Returns a random float number between 0 and 1 |
uniform() | Returns a random float number between two given parameters |
betavariate() | Returns a random float number between 0 and 1 based on the Beta distribution (used in statistics) |
expovariate() | Returns a random float number based on the Exponential distribution (used in statistics) |
gammavariate() | Returns a random float number based on the Gamma distribution (used in statistics) |
gauss() | Returns a random float number based on the Gaussian distribution (used in probability theories) |
lognormvariate() | Returns a random float number based on a log-normal distribution (used in probability theories) |
normalvariate() | Returns a random float number based on the normal distribution (used in probability theories) |
vonmisesvariate() | Returns a random float number based on the von Mises distribution (used in directional statistics) |
paretovariate() | Returns a random float number based on the Pareto distribution (used in probability theories) |
weibullvariate() | Returns a random float number based on the Weibull distribution (used in statistics)
Lesson 3.16
also known as a virtual experiment
Experiment(vs simulation) definition: procedure undertaken to make a discovery, test a hypothesis, or demonstrate a known fact
simulations are safer and cheaper, although experiments are more accurate.
four corners : an example of a simulation and experiment = the game of 4 corners
Lesson 2.17-3.18
The Collatz conjecture is one of the most famous unsolved problems in mathematics. The conjecture asks whether repeating two simple arithmetic operations will eventually transform every positive integer into 1.
The sequence of integers generated by Collatz conjecture are called Hailstone Numbers. Examples:Input : N = 7 Output : Hailstone Numbers: 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 No.> ### Iteration The action or a process of iterating or repeating:such as. : a procedure in which repetition of a sequence of operations yields results successively closer to a desired result.
An undecidable problem is one that should give a “yes” or “no” answer, but yet no algorithm exists that can answer correctly on all inputs.
An unsolvable problem is one for which no algorithm can ever be written to find the solution.
Bits, Bytes, Hexadecimal / Nibbles:
One byte is equivalent to eight bits.
Nibble: four consecutive binary digits or half of an 8-bit byte.
Hexadecimal: A byte (or octet) is 8 bits so is always represented by 2 Hex characters in the range 00 to FF.
Binary Numbers: Unsigned Integer, Signed Integer, Floating Point
Unsigned Integer: ust like integers (whole numbers) but have the property that they don’t have a + or - sign associated with them.
signed integer: A signed integer is a 32-bit datum that encodes an integer in the range
Floating point: A number type that may represent decimal values is a floating point number. It is stored in a particular format in a computer’s memory and is composed of a mantissa and an exponent.
Boolean: A boolean is a type of data that only has the options of true or false. In programming, it is frequently used to indicate the result of a comparison or logical process.
ASCII: The American Standard Code for Information Interchange (ASCII) is a convention for how characters are represented in computers. Each numerical value that it uses to represent a character is associated with a particular character.
Unicode is a standard for how characters are displayed on computers. Despite having a far larger variety of characters than ASCII and being able to represent characters from several languages and scripts, it is comparable to ASCII. RGB: The color model RGB (Red Green Blue) is utilized in computer graphics and digital photography. By blending various red, green, and blue light intensities, it simulates color.
Lossy: A method of data compression called lossy involves throwing away some of the data in order to make the data smaller. The quality may suffer as a result, but the data may become more manageable and straightforward to send.
Data compression that doesn’t cause any data loss is known as lossless data compression. It functions by figuring out methods to more effectively portray the data without erasing any of the original data.
Programming terms for designated storage areas that may store values are variables. A variable’s value can be altered while a program is running.
Data types are a way for programmers to categorize data according to the kind of value that it can store. Integers, floating point numbers, strings, and booleans are examples of common data types.
Assignment operator: In programming, an assignment operator is a symbol that is used to give a variable a value. The equal symbol (=) is used as the assignment operator in Python.
Lists: A list is an ordered collection of values in programming. Any data type may be stored in a list, and its indices can be used to access those items (the position of the value in the list).
Lists that include other lists are referred to as 2D lists.