Solutions to lists HW12:

#-----------------------
def add1Modify(L):
    for i in range(len(L)):  # must use range, since we need the index
        L[i] += 1
    return L

#-----------------------
def add1Copy(L):
    LCopy = []
    for num in L:  # we don't need index here, so don't need range()
        LCopy += [num+1]
    return LCopy

# Note: if we have a copy of L, we can safely modify the copy
def add1Copy2(L):
    LCopy = L[:] # Copy all the elements of L by slicing
    return add1Modify(LCopy)