Opening your workspace…
Workspace/Coding room
Opening your workspace…
Your cabbage cart has crossed paths with the Avatar all year. Given the number of cabbages the Avatar ruined each month, count how many cabbages you lost altogether.
[1,0,2,0,1,0,0,3,0,1,0,0]Output8Add the monthly losses: 1 + 2 + 1 + 3 + 1 = 8 cabbages.
[0,0,0,0,0,0,0,0,0,0,0,0]Output0No cabbage carts were wrecked, so you lost no cabbages.
Add the twelve monthly losses.
function solve(monthlyLosses) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.