Skip to content
dreamcode
dreamcode
Peaks
Rain Counter
BeginnerPython
Reward: +40 XP
PROBLEM

Rain Counter

Given a list of lists of numbers representing raindrops in different sectors of the sky, calculate the total number of raindrops. Return 0 if there are no raindrops.

Examples
total_raindrops([[1, 2], [3, 4]])
10
total_raindrops([[], [5]])
5
solution.py
PYTHON
Saved as you type

Tests

0 of 3 passing
  • [[1, 2], [3, 4]] → 10
    total_raindrops([[1, 2], [3, 4]])
    expected 10
  • [[], [5]] → 5
    total_raindrops([[], [5]])
    expected 5
  • [] → 0
    total_raindrops([])
    expected 0
On the line
+40 XP
Pass all 3 tests to claim it.