Solution 1

``````def create_counting_list(count_to_number):
counting_list = []
count = 0
if count_to_number >= 0:
while count < count_to_number:
count += 1
counting_list.append(count)
return counting_list
return 'cannot be negative'
``````

# Create counting list

Define a function `create_counting_list` that receives a number to count up
to. Normally because you know the number of loops you would want to use a for
loop but in this case we will use a while loop to emulate a for loop.

Return a list where each element counts up to the number provided starting from 1. If
the number provided to count to is negative, return 'cannot be negative'.

Examples:

``````>>> create_counting_list(7)
[1, 2, 3, 4, 5, 6, 7]
>>> create_counting_list(3)
[1, 2, 3]
>>> create_counting_list(0)  # Special case, pay attention!
[]
>>> create_counting_list(-1)  # Error if -1 is passed
'cannot be negative'
``````

### Test Cases

test count to 3 -

``````def test_count_to_3():
assert create_counting_list(3) == [1, 2, 3]
``````

test do not count -

``````def test_do_not_count():
assert create_counting_list(0) == []
``````

test count to 7 -

``````def test_count_to_7():
assert create_counting_list(7) == [1, 2, 3, 4, 5, 6, 7]
``````

test negative -

``````def test_negative():
assert create_counting_list(-1) == 'cannot be negative'
``````
def create_counting_list(count_to_number): pass