3.1-3.2 Notes
Variables, Assignments, and Data Abstraction
Notes | Hacks | Grade |
3.1-3.2 Notes | 3.3-3.4 Hacks | |
3.3-3.4 Notes | 3.3-3.4 Hacks | |
3.5-3.7 Notes | 3.5-3.7 Hacks |
Variables
An abstraction inside a program that can hold a value
- Variables should be something simple; not very complicated and not to vague
- Use meaningful variables to help the program be easier to read Three parts of a variable:
- name
- value
- type
Types of data
- integer (number)
- Text/string: word Boolean: Data that determines if something is true or false
lists can be stored as variables
specific values in the list can be retrieved from the list without creating multiple variables and data can be easily changed
Assignments
assigns values to variables
Allows the program to change the value represented by a variable
Data Abstraction
- represents data in a useful form, takes away aspects of data that are unused in the situation
- variables and lists and main tools for data abstraction
- separates abstract properties of data type and concrete details of its representations
Lists in Data Abstractions
- Multiple elements can be stored together and treated as a single value in a list
- Data abstraction is possible
- Elements can be added