Type an Array of Numbers
Write the code, see it run, pass the checks.
The problem
- easy
- Code
Write total(prices), which adds up a list of prices and returns 0 for an empty list. Type the list as an array of numbers, so passing a list of strings is a type error.
Your code must pass
- Adds up the prices
- Returns 0 for no prices
- Has no type errors
- Takes an array of numbers
- Rejects an array of strings