Course of Raku / Addendum 🆕 / Working with data / Lists, arrays, and hashes / Exercises
Running totals
Problem
Given the list 2, 4, 6, 8, produce the list of running
totals — each element is the sum of all values up to and including that
position — giving [2 6 12 20]. Print it.
Example
The program prints:
[2 6 12 20]Solution
Course navigation
← Solution: Merge two inventories | Solution: Running totals →