Question: Trying to print the value in y for the number of times that shows in x.

How should I modify the following syntax to achieve the expected output?

```
x = 5
y = ['a', 'b']
z = []

for num in list(range(x)):
    for idx, num1 in enumerate(y):
        z.append(num1)

```

Output based on above:

```
['a', 'b', 'a', 'b', 'a', 'b', 'a', 'b', 'a', 'b']

```

Expected output:

```
['a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'b']

```

Answer: 
An empty array have no element, so it dose not run reduce function.
But [null] array has one element 'null'. So this array run reduce function.
As mentioned in the docs:

> 
> The reduce() method executes a user-supplied “reducer” callback function on each element of the array
> 
> 
> 

If there are no elements the callback won't run

<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce>