Student Teaching Week 1 Review
- Day 1 Topic: Variables, Assignments, and Data Abstraction
- Day 2 Topic: Mathematical Expressions and Strings
- Algorithms and Logic
Day 1 Topic: Variables, Assignments, and Data Abstraction
Variables
-dos when naming variable: make it simple Types of data
- Integer: numbers
- Text/string: words
- Boolean: Data that determines if something is true or false Data can be stored in variables
- so that you ca print retrieve specific values in the list w/o creating many variables
- easy to remove/add/change items into the list
Assignments
Operators: allows a program to change the value represented by a variable (=,+=,-=,*=,/=,**=) Values can be stored in a variable
Data Abstraction
- Method used to represent data in a useful form, by taking wy of data that aren't being used int eh situation
- Variables and lsts are tools usied in data abstraction
- It provides a separation between the abstract properties of data type and concrete details of its representation
Lists and Strings
- list: ordered sequesnt of elements
- element: individual value in a list that is assigned to a unique index
- index: a way to reference the elements in a list or string using natural numebrs; each element of a string is referenced by an index
- string: orderedsequanc of charaters (etters, numbers, special charaters)
- lists can be used to store multiple elements
Day 2 Topic: Mathematical Expressions and Strings
Algorithms
- a set of instructions that can accomplish a task
- Sequencing= order in which instructions are performed
- Selection= choose which outcome based off a decision
- Iteration= if a condition is true then the code can repeat
Mathematical Expressions
- Arithmetic operations exist in most programming languages
- Subtraction (-), Addition (+), Multiplication (*), Division (/), Remainder(MOD) (%) Order of operations
- parentheses are done first
- then division and multiplication and modulus
- addition and subtraction
Variables
- values can be stored in variables by setting a variable equal to certain values
- sequencing w/ variables takes the most recent assignment
Strings
- collection of characters
- characters can be anything from numbers, letters, spaces, special symbols
- len()= length of a string
- lower()= converts to lowercase
- used to handle textual data
console.log("AND: 7 & 4")
console.log("Thinking: 111 & 100 --> 100")
console.log("Answer: 4")
console.log("Test:")
console.log(7 & 4)
console.log()
console.log("OR: 5 | 3")
console.log("Thinking: 101 | 011 --> 111")
console.log("Answer: 7")
console.log("Test:")
console.log(5 | 3)
console.log()
console.log("XOR: 2 ^ 8")
console.log("Thinking: 0010 ^ 1000 --> 1010")
console.log("Answer: 10")
console.log("Test:")
console.log(9 ^ 3)
console.log()
console.log("NOT: ! 1")
console.log("Thinking: false is 1 in binary, not true is false")
console.log("Answer: true")
console.log("Test:")
console.log(! 1)