Variables, Assignments, and Data Abstraction
* Keep variable names simple but not too vague
* Spaces and dashes in variable names are improper syntax
* Variable types:
- Integers are numbers
- Text/strings are words (not always)
- Booleans are data that determine true/false
* Lists can be stored in variables for easy access
* Assignment operator allows programs to change values of a variable
- = : Sets equal
- += : Adds right to left
- -= : Subtracts right from left
- *= : Multiplies right by left
- /= : Divides left by right
* Data abstraction represents data in a useful form
- Variables and lists
* List = Ordered sequence of elements
- Related items can be treated as a single value
- Can keep adding elements
- Store more elements in a single variable
* Element = Individual value in a list with a unique index
* Index = Way to reference the elements in a list or string using natural numbers (you can do negative in Python tho??)
- AP Exam has it start at 1
* Python allows you to append lists to lists but on the AP Exam it just replaces the other list
* Hacks
* Grade:
# Mathematical Expressions and Strings
* Sequences are the order that algorithms do things
* Selection chooses different outcomes from a decision
* Iteration repeats code until true
![stuff](https://github.com/manigggg18/manimani/blob/master/images/12345.png?raw=true)
* Remainder represented by MOD (% in python)
* Follows same order of operations as regular mathematics
* Numerical values can be stored in variables, as well as other variables, the results of mathematical operations, and results of procedure calls
* Strings can be anything
* Concatenation adds two strings (like just + in python)
* substring(string, starting index, ending index)
- substring("thisisabruhmoment", 8, 11) returns "bruh" (CollegeBoard index starts at 1)
* Hacks
* Grade: 0.9/1
# Boolean
* If and else and else if
* returns only 2 possible outputs, true or false
* includes <, >, =, !=, etc.
* Hacks
* Grade: 0.95/1
# Lists & Iteration
* Iteration is the repetition of a process
- Loops (for, while, recursive)
* Matrices are complicated lol
* Hacks
* Grade: 1/1
# Algorithms
* Algorithms are processes through code
* Conditions are boolean expressions that output true or false
* Binary search finds the index of specific values in a list by splitting in half the max(?)
* Hacks
* Grade: 0.9/1
# Procedures
* Procedures are named groups of programming instructions that may have parameters and return values
- Parameters are inputs like n in function(n)
- return values are the outputs kind of
- Also called methods and functions
* Arguments specify the values of parameters
* Procedure calls interrupt the sequential execution of statements to execute code within the procedure before continuing where the procedure was called
* Procedures can return blocks of statements or data like booleans or values
* Procedure names should be succinct
- Consider input values, purpose
- Start with a flowchart (NO)
* Hacks
* Grade: 0.75/1
# Simulations
* Used to test hypothetical situations to prevent real-world consequences
* Hacks
* Grade: 0.8/1
# Algorithmic Efficiency
* Minimize resources used (mainly time and memory)
* Efficiency can be determined with time complexity or space complexity
- Bubble sort better than insertion because takes less iterations
* Heuristic solutions are shortcuts, not necessarily optimal but can make it faster
* Hacks
* Grade: 0/1 (OOPS)