Instructions
Write a function sum
that consumes a list of numbers and
produces the total of all the numbers in the list.
Note:
Hint:
- Use a while loop.
Write a function divides_all
that consumes a list of positive integers seq
and a positive integer factor
. Your function should produce True
if every item in seq
is a multiple of factor
and False
otherwise. The helper function is_multiple
has been provided for you.
Note:
Hint:
- You can return
False
as soon as you discover an item ofseq
which is not a multiple offactor
.
Write a function remove_zero
that uses mutation to remove all zeroes from an input list of numbers.
Note:
Hint:
- Use
remove
andin
.
Write a function no_zero
that consumes a list of numbers and produces a new list formed by removing all the zeroes from the input list. Do not mutate the input.
Note:
Hints:
- Make sure to initialize your new list outside of the while loop.
Write a function reverse
that mutates the input list of numbers by reversing the order of items in the list.
Note:
Hints:
- You can reverse a list by swapping the first and last items, then the second and second-to-last, and so on.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX