Unit 3 Sections 1-4 Notes
This blog includes notes that I took from the lessons for sections 1-4.
- Unit 3.1 Variables and Assignments
- Unit 3.2 Data Abstraction
- Unit 3.3 Expressions
- Unit 3.4 Strings
- 3.1-3.4 Takeaways
Unit 3.1 Variables and Assignments
Key points:
- Variables are abstractions within programs which represent a value
- Values can be individual data points or a list/collection that contains many data values
- Types of data: numbers, Booleans (T/F), lists, and strings
Variables and Assignments (Python)
- To define a variable, simply type in the variable name and use the equal sign to set it equal to its value
- Variable can be defined using numbers, string, list, or boolean (strings must have quotations around it and lists must be surrounded by square brackets)
- Dictionaries
- Interchanging variables
- Floats
- Even Function
Variables and Assignments (JavaScript)
- One way to assign a variable is doing var (variable name) = value;
- Another way to assign a variable is using const (variable name) = value;
Unit 3.2 Data Abstraction
Key points:
- Data abstraction provides a separation between the abstract properties of a data type and the concrete details of its representation
- Data abstraction manages complexity in programs by giving a collection of data a name without referencing the specific elements of the representation
- Data Abstraction makes it easier to implement, develop, and maintain code
- The use of lists allows for multiple related values to be treated as a single value
Unit 3.3 Expressions
- the symbol for exponent is “**”
- the symbol for addition is “+”
- the symbol for subtraction is “-“
- the symbol for multiplication is “*”
- the symbol for division is “/”
- the symbol for modulus is “%”
- an algorithm is a sequence of steps that are made to perform a specific task repeatedly.
Unit 3.4 Strings
Pseudo Code
- Pseudo code is writing out a program in plain language with keywords that are used to refer to common coding concepts
- Does not use actual code
- Can be used to explain a concept about coding to someone who has no experience with
- Begins at index 1
Length
- The length of a string in coding is essentially the number of coding units or characters present in a string. For example, the length of the string “hello” would be 5.
Concatenation
- Concatenation is basically joining two strings together to form one string. For example, one could concatenate the strings “hello” and “world” in order to make a single string that says “hello world”
Substring
- A substring is a subset or a part of another string. For example, “hello” would be considered a substring in the string “hello world”.
3.1-3.4 Takeaways
Overall, I felt that I was able to learn a lot from other students teaching us these concepts (data abstraction, assignments, etc.). I also believe that I will find these notes very useful for when I study for the AP Exam as well as when I work on my Create Performance Task.