I did not get anything wrong, However I gained a better understanding of many different concepts. I learned more in depth about the main types of loops (for, while, recursive), and I was also able to learn more about the importance of iterations and lists. Learning more about certain features of lists such as the append and pop option allows me to automate certain code snippets in a more efficient manner, rather than nesting identical code to complete the same task, but in a more tedious manner.
Exercises:
Notes:
Functions to count how many items in a list
len() → finds length
List = [1, 2, 3]
len(list) = 3
range() → sequence of numbers between lower and upper bond
list = [1,2,3]
range(len(list)) = range(3) = index 0 to 2
Functions to add or remove items in a list
pop() → remove last object in a list
List = [“strawberry”, “blueberry”]
list.pop()
print(List) = [“strawberry”]
remove() → remove object in a list
List = [“strawberry”, “blueberry”]
list.remove(“strawberry”)
List = [“blueberry”]
insert() → insert item at certain index in list
List = [1, 3, 4]
list.insert(1, 2)
print(list) = [1, 2, 3, 4]
append() → adds item to end of list
List = []
list.append(“Yay”)
List = [“Yay”]
Iteration
For loop - use when number of iterations is known
While loop - program keeps running as long as condition is true
Vocab:
Elements - an item in a list
Nesting - having one data type or function inside another data type or function
Array - alternate name for a list
Initialization - whatever sets the counter variable to a starting value.
Condition - allows the computer to know whether or not to keep repeating the loop.
Quiz and Revisions:
I did not get anything wrong, However I gained a better understanding of many different concepts. I learned more in depth about the main types of loops (for, while, recursive), and I was also able to learn more about the importance of iterations and lists. Learning more about certain features of lists such as the append and pop option allows me to automate certain code snippets in a more efficient manner, rather than nesting identical code to complete the same task, but in a more tedious manner.
Exercises:
Notes: Functions to count how many items in a list len() → finds length List = [1, 2, 3] len(list) = 3 range() → sequence of numbers between lower and upper bond list = [1,2,3] range(len(list)) = range(3) = index 0 to 2 Functions to add or remove items in a list pop() → remove last object in a list List = [“strawberry”, “blueberry”] list.pop() print(List) = [“strawberry”] remove() → remove object in a list List = [“strawberry”, “blueberry”] list.remove(“strawberry”) List = [“blueberry”] insert() → insert item at certain index in list List = [1, 3, 4] list.insert(1, 2) print(list) = [1, 2, 3, 4] append() → adds item to end of list List = [] list.append(“Yay”) List = [“Yay”] Iteration For loop - use when number of iterations is known While loop - program keeps running as long as condition is true
Vocab: Elements - an item in a list Nesting - having one data type or function inside another data type or function Array - alternate name for a list Initialization - whatever sets the counter variable to a starting value. Condition - allows the computer to know whether or not to keep repeating the loop.