Lesson 3.1 and 3.2 Homework
Finishing the Homework
3.17 and 3.18 Hacks | Lesson 3.14-3.15 Hacks | Lesson 3.12-3.13 Hacks | Lesson 9-11 Hacks | Lesson 8 and 10 Hacks | Lesson 5-7 Hacks | Lesson 3.1 and 3.2 Homework | Lesson 3.3 and 3.4 Homework |
Hack 1:
Hack 2: In your own words, briefly explain by writing down what an assignment operator is
- an operator is a procedure that gives an output.
In Collegeboard pseudocode, what symbol is used to assign values to variables?
- the symbol <– is used to assign a variable for college board (or in pseudo code).
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?
- If you print x, then the value will be changed to 22 because the computer takes the variable that has been assigned the latest. Since assigning x to 22 is the most recent line of code, more recent than x = 15, the program will output 22.
Hack 3: What is a list?
- a list is a series of variables.
What is an element
- a smaller component in a larger system of code
What is an easy way to reference the elements in a list or string?
- it is easier to reference the elements in a list because that way they are all in one place and are in one line of code instead of multiple.
What is an example of a string
- 123-456-7890 (a phone number)
List:
Index:
Hack 4:
Hack 5: Python Quiz
Before:
Simplified version:
Why are using lists better for a program, rather than writing out each line of code?
- lists are better because that way you have all your variables in one place instead of multiple lines of code. It also manages complexity.
My own version of a list (both the long way and the simple way :)