fizz_array_2

Given a number n, create and return a new string list of length n, containing the strings “0”, “1” “2” .. through n-1. N may be 0, in which case just return a length 0 list. Note: String.valueOf(xxx) will make the String form of most types. The syntax to make a new string list is: new String[desired_length]  (See also: FizzBuzz Code)

This exercise was taken from codingbat.com and has been adapted for the Python language. There are many great programming exercises there, but the majority are created for Java.

Test 1

Input:

4

Output:

['0', '1', '2', '3']

Test 2

Input:

10

Output:

['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

Test 3

Input:

2

Output:

['0', '1']

Test 4

Input:

1

Output:

['0']

Test 5

Input:

0

Output:

[]

Test 6

Input:

7

Output:

['0', '1', '2', '3', '4', '5', '6']

Test 7

Input:

9

Output:

['0', '1', '2', '3', '4', '5', '6', '7', '8']

Test 8

Input:

11

Output:

['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']