Team One Homework- Lessons 3.1-3.2
Data Types, Variables, Lists, Strings, Data Abstraction, Managing Complexity
- Hacks 1 1.1(Data Types and Variables)
- Hacks 2 3.1.2(Variables)
- Hacks 3 3.2.1 (List and Strings using Variables)
- Hack 4 3.2.2 (Data Abstraction with Lists)
- Hacks 5 3.2.3 (Managing Complexity with Lists)
Hacks 1 1.1(Data Types and Variables)
Hacks 2 3.1.2(Variables)
-
An assignment operator, like the “=” in python, assigns a value to a variable. Assignment operators can assign strings, integers, and booleans to variables. This allows for a user to use the variables in various functions.
-
In Colledgeboard pseudocode, the symbol “<–” is the assignment operator (assigns values to variables).
-
The print command will print the latest value of a variable. Due to the value of x being changed to 22, the command will display 22, not 15.
Hacks 3 3.2.1 (List and Strings using Variables)
- A list is a finite series of ordered values.
- An element is a value within a list.
- An easy way to reference the elements in a list or string is by indexing. You can use the print function to print a specific element in a list.
- An example of a string is “apple”.
Below is my list that I created of my favorite foods. Additionally, I created a dictonary of lists and indexed the elements within these lists as well.
Hack 4 3.2.2 (Data Abstraction with Lists)
Hacks 5 3.2.3 (Managing Complexity with Lists)
Below is my quiz:
Below is my simplified list:
Question: Using lists are better for a program, rather than writing out each line of code, because lists manage complexity within a program. It is much easier and saves a lot of time to organize values in a list. Lists also make it easier for other programers to understand a program instead of tracking numerous variables. Writing out each line of code takes a lot of time as well, and can get very tiring as you add more values to a program.
Below is a list of my friends the slow way and with managed complexity: