How do you read `object.operation` dot notation, and build a filtered list from an empty list, a loop, and append?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
Starting from the empty list squares, build up the square of every integer from 0 up to and including n, in order — loop over a range and append as you go. With n = 5, squares should end up as [0, 1, 4, 9, 16, 25].
Object on the left, operation on the right
Write the rule for reading L.append(5) as an object plus a function call with arguments, and record that every Python value is an object with data and behaviors.
make_ordered_list(n) construction pattern
Write the function starting from an empty my_list (never named list), looping over range(n + 1), appending each i, and returning it, with make_ordered_list(6) giving [0, 1, 2, 3, 4, 5, 6].
remove_elem(L, e) filtering pattern
Write the function that loops over the elements of L, appends each element unequal to e into a new list, and returns it, testing [1, 2, 2, 2, 2] with e = 2 giving [1].