dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
1.7 KiB
1.7 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6a0dcc730cb92a616f86f0c5 | Challenge 301: Last Load | 29 | challenge-301 |
--description--
Given the number of scoops of laundry detergent you have remaining and an array of how many scoops you used in each of the previous days, return the number of full days of detergent you have remaining.
Calculate your average daily usage from the usage history and assume that amount of usage each day going forward.
--hints--
last_load_date(10, [2, 2, 2, 2, 2, 2, 2]) should return 5.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(last_load_date(10, [2, 2, 2, 2, 2, 2, 2]), 5)`)
}})
last_load_date(16, [2, 3, 0, 3, 4, 2, 1]) should return 7.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(last_load_date(16, [2, 3, 0, 3, 4, 2, 1]), 7)`)
}})
last_load_date(33, [5, 0, 4, 3, 3, 2]) should return 11.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(last_load_date(33, [5, 0, 4, 3, 3, 2]), 11)`)
}})
last_load_date(50, [2, 0, 2, 9, 12, 0, 2]) should return 12.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(last_load_date(50, [2, 0, 2, 9, 12, 0, 2]), 12)`)
}})
last_load_date(20, [13, 9, 12, 10, 8]) should return 1.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(last_load_date(20, [13, 9, 12, 10, 8]), 1)`)
}})
--seed--
--seed-contents--
def last_load_date(scoops, usage):
return scoops
--solutions--
def last_load_date(scoops, usage):
avg = sum(usage) / len(usage)
return int(scoops / avg)