Jamie is a programmer, and James' girlfriend. She likes diamonds, and wants a diamond string from James. Since James doesn't know how to make this happen, he needs your help.

## Task

You need to return a string that looks like a diamond shape when printed on the screen, using asterisk (`*`) characters. Trailing spaces should be removed, and every line must be terminated with a newline character (`\n`).

Return `null/nil/None/...` if the input is an even number or negative, as it is not possible to print a diamond of even or negative size.


## Examples

A size 3 diamond:

```
 *
***
 *
```

...which would appear as a string of `" *\n***\n *\n"`


A size 5 diamond:

```
  *
 ***
*****
 ***
  *
```

...that is: `"  *\n ***\n*****\n ***\n  *\n"`

Difficulty: introductory

Starter code:

def diamond(n):
	

Solutions:
def diamond(n):
    if n < 0 or n % 2 == 0:
        return None
    
    result = "*" * n + "\n";
    spaces = 1;
    n = n - 2
    while n > 0:
        current = " " * spaces + "*" * n + "\n"
        spaces = spaces + 1
        n = n - 2
        result = current + result + current
    
    return result

def diamond(n):
    w = ''
    space = n//2
    starnum = 1
    while starnum < n:
        w += space * ' ' + starnum * '*' + '\n'
        starnum += 2
        space -= 1
    while starnum > 0:
        w += space * ' ' + starnum * '*' + '\n'
        starnum -= 2
        space += 1
    return w if n%2 != 0 and n > 0 else None


def diamond(n):
    if n%2 == 0 or n <= 0:                        # validate input
        return None
    diamond = "";                                 # initialize diamond string
    for i in range(n):                            # loop diamond section lines
        length = getLength(i, n)                  # get length of diamond section
        diamond += getLine(length, n)             # generate diamond line
    return diamond
    
def getLine(len, max):
    spaces = (max-len)//2                         # compute number of leading spaces
    return (" " * spaces) + ("*" * len) + "\n"    # create line
    
def getLength(index, max):
    distance = abs(max//2 - index)                # find distance from center (max length)
    return max - distance*2                       # compute length of diamond section

def diamond(n):
    return "".join([("*"*k).center(n).rstrip()+"\n" for k in range(1, n+1, 2)] + \
        [("*"*k).center(n).rstrip()+"\n" for k in range(n-2, 0, -2)]) if n > 0 and n % 2 == 1 else None