Count up
Inputs
n is a whole number from 0 to 20.
Your tasks
- Create an empty list
numbers. - Use a loop to add the whole numbers from 1 up to and including
ntonumbers, in order. - Complete
countUpso it returnsnumbers. Return it, do not print it.
Example
With n = 5, countUp returns [1, 2, 3, 4, 5].
Rules
- If
nis 0, return an empty list.
Test data
TEST DATA 1: n is 5
TEST DATA 2: n is 0
Practice focus
Loops that count, add up and multiply. Every algorithm starts here: a counter, a total and a stopping point.