Table of multiples
Inputs
k is a whole number from 1 to 12. count is a whole number from 0 to 12.
Your tasks
- Create an empty list
multiples. - Use a loop that runs
counttimes. On round 1 addk, on round 2 addk * 2, and so on. - Complete
multiplesOfso it returnsmultiples. Return it, do not print it.
Example
With k = 3 and count = 5, multiplesOf returns [3, 6, 9, 12, 15].
Rules
- If
countis 0, return an empty list.
Test data
TEST DATA 1: k is 3, count is 5
TEST DATA 2: k is 7, count is 0
Practice focus
Loops that count, add up and multiply. Every algorithm starts here: a counter, a total and a stopping point.