Multiply them all
Inputs
values is a list of 0 to 8 whole numbers, each from -4 to 4.
Your tasks
- Create a number
productthat starts at 1. - Use a loop to multiply
productby every number invalues. - Complete
listProductso it returnsproduct. Return it, do not print it.
Example
With values = [2, -3, 4], listProduct returns -24.
Rules
- An empty list has a product of 1.
Test data
TEST DATA 1: values is [2, -3, 4]
TEST DATA 2: values is []
Practice focus
One pass over a list to add, count, find the biggest and the smallest. Scanning an array once and keeping a running answer is the backbone of linear-time solutions.