write a function sum that takes a list of numbers and returns the sum of those numbers
accumulator variable
Python has as a built-in sum function
Mystery
list of lists
data = [[1,2],[3,4],[5,6]] acc = 0 for x in data: for num in x: acc = acc + num print(acc)
Practice
write a function is_sorted that takes a list and returns True if the elements are in ascending order
for i in range(len(nums)) loops over the indexes of nums
write a function cumulative_sum that takes a list of numbers and returns a new list where each element is the sum of the elements of the original list up to that point
use my_list.append(x) to add x to the end of my_list