Unit 3.1-3.4 Notes
My notes from week 1 of student lessons
Lesson 3.1-3.2 Notes
College Board Essential Knowledge
A variable is an abstraction inside a program that holds a value
- each variable has associated data storage that represents a single value at a time
- if the value is a collection type such as a list, then the value can contain multiple values
Variables typically have meaningful names
- helps with the overall organization of the code and understanding of what is being represented
- Some programming languages provide a variety of methods to represent data
- referenced using variables 9Booleans, numbers, lists, and strings
- One form of a value is better suited for representation than another.
What are Variables?
- Variables are abstractions made inside a program that holds a value.
- These variables are used in code to refer to more comples values that the variable contains and makes the program code more organized and smoother to run.
Variables can be seen as "containers"
- each container has a name that holds what it is supposed to hold
More Essential Knowledge
- What exactly IS a variable?
A: An abstraction that contains more code
- What is the best data type to represent someone's dog's name?
A: String
- Why is it important to give variables specific names before containing values?
A: So the code is organized
- What is the best way to represent someone's phone number?
A: String
In your own words, briefly explain by writing down what an assignment operator is
- An assignment operator is an equal sign, which is needed in order to store a value inside a variable.
In Collegeboard pseudocode, what symbol is used to assign values to variables?
- <--
A variable, x, is initially given a value of 15. Later on, the value for x is changed to 22. If you print x, would the command display 15 or 22?
- 22
- What is a list?
A: Lists are sequences of elements where every element = a variable.
- What is an element
A: Elements are variables that are parts of lists.
- What is an easy way to reference the elements in a list or string?
A: An easy way to access elements is by putting the elements in an index and then using numbers to call specific parts of the string.
- What is an example of a string?
A: "hello world"
Data Abstraction
- Lists bundle together multiple elements and/or variables under one name are not defined with specified lengths.
- The variables that are stored in a list do not have to be limited to one kind of variable.
- The user does not need to know how the list stores data (this gives way for data abstraction).
How will this help with the AP Test?
The essential knowledge about variables within this lesson will help us to prepare for what we need to know during the college board test. By understanding variables, what they are and how they are used, we will be able to to have a deeper understanding and will be able to apply it to real world situations and the test.
Lesson 3.3-3.4 Notes
What is an algorithms?
- An algorithm is a finite set of instruction that accomplish a task, it can be expressed by natural language, diagrams, and various other ways.
What are the three parts of an algorithm?
Sequencing, selection, and iteration.
Every algorithm can be created by a mixture of sequencing, selection, and iteration
What is a sequence?
- A sequence is the order of how to do something to achieve a result, similarly to how you follow the instructions from a teacher.
What is a selection?
- A selection allows an algorithm to make a decision based on if a condition is met, an example of this is when your car is out of fuel, you go to the gas station to fill your car, but if your car is full you wouldn't go to the gas station.
What is a iteration?
- An iteration is a loop and doing something again until a condition is met, like you put away your computer when you are finished with your work.
How do we represent a step-by-step algorithmic process using sequential code statements?
- First off what is a sequential code statement?
- Sequential statements are used in processes to specify how signals are assigned. The process is executed in order as a whole. After all the sequential statements in the process are executed the signals are assigned their new values. They execute in the order in which they appear in the process.
- Sequencing - First step to do- Second step to do - third step to do
- Followed in the order that the code comes in.
- You can put numerical values within variables. You can also put variable values inside other variables
- Ex. grade - 82
- Ex. highScore - currentScore
- Can also store results of operations inside of a variable
- Ex. name - firstName + lastName
- Can store results of a procedure call
- Average - calcAverage (10,20,30)
- Order of operations very important
- Ex. grade1 - 10
How will this help with the AP Test and beyond?
Learning about algorithms and the three parts of them will allow us to apply it to questions about sequencing, selection and iteration. By learning these foundational parts of coding, we will be able to code our own programs and answer questions on the AP test.