Write a dfn to produce a vector of the first n odd numbers.

```
{your_solution} 10
1 3 5 7 9 11 13 15 17 19
{your_solution} 1
1
{your_solution} 0 ⍝ this should return an empty vector
```

Write a dfn which returns the percent (from 0 to 100) of passing (65 or higher) grades in a vector of grades.

```
{your_solution} 25 90 100 64 65
60
{your_solution} 50
0
{your_solution} 80 90 100
100
{your_solution} ⍳0 ⍝ all grades in an empty vector are passing
100
```

Write a dfn which returns the number of words in the given character scalar or vector.

For simplicity’s sake, you can consider the space character `' '`

to be the only word separator.

```
{your_solution} 'Testing one, two, three'
4
{your_solution} '' ⍝ empty vector has no words
0
{your_solution} ' this vector has extra blanks ' ⍝ just counting the blanks won't work
5
```

Write an APL dfn which returns a 1 if the opening and closing parentheses in a character vector are balanced, or a zero otherwise.

```
{your_solution} '((2×3)+4)'
1
{your_solution} ''
1
{your_solution} 'hello world!'
1
{your_solution} ')(2×3)+4('
0
{your_solution} '(()'
0
{your_solution} ')'
0
```

An identity matrix is a square matrix (table) of 0 with 1’s in the main diagonal.

Write an APL dfn which produces an n×n identity matrix.

```
{your_solution} 5
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
{your_solution} 1 ⍝ should return a 1×1 matrix
1
{your_solution} 0 ⍝ should return a 0×0 matrix
```

Write a dfn which returns the magnitude of the range (i.e. the difference between the lowest and highest values) of a numeric array.

```
{your_solution} 19 ¯3 7.6 22
25
{your_solution} 101 ⍝ should work with a scalar argument
0
{your_solution} 2 3⍴10 20 30 40 50 60 ⍝ should work with arrays of any number of dimensions
50
{your_solution} ⍳0 ⍝ including empty arrays
0
```

Write a dfn which selects the floating point (non-integer) numbers from a numeric vector.

```
{your_solution} 14.2 9 ¯3 3.1 0 ¯1.1
14.2 3.1 ¯1.1
{your_solution} 1 3 5 ⍝ should return an empty vector
{your_solution} 3.1415
3.1415
```

Write a dfn which produces a multiplication table.

```
{your_solution} 5
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
{your_solution} 1 ⍝ should return a 1×1 matrix
1
{your_solution} 0 ⍝ should return a 0×0 matrix
```

Write a dfn which produces n month moving averages for a year’s worth of data.

```
sales←200 300 2700 3400 100 2000 400 2100 3500 3000 4700 4300
2 {your_solution} sales ⍝ produces 2 month moving averages
250 1500 3050 1750 1050 1200 1250 2800 3250 3850 4500
10 {your_solution} sales ⍝ 10 month moving average
1770 2220 2620
1 {your_solution} sales ⍝ 1 month moving average is the same as sales
200 300 2700 3400 100 2000 400 2100 3500 3000 4700 4300
```

Many people have taken some sort of algebra class where you are presented with a set of linear equations like:

3x + 2y = 13

x - y = 1

The answer in this case is x=3 and y=2

Write a dfn which solves this type of problem. Hint: this is the easiest of all of the problems presented here.

The left argument is a vector of the values for the equations and the right argument is a matrix of the coefficients.

```
13 1 {your_solution} 2 2⍴3 2 1 ¯1
3 2
2 6 4 {your_solution} 3 3⍴4 1 3 2 2 2 6 3 1
¯1 3 1
```