Your aged grandfather is tragically optimistic about Team GB's chances in the upcoming World Cup, and has enlisted you to help him make [Union Jack](https://en.wikipedia.org/wiki/Union_Jack) flags to decorate his house with. 

## Instructions
* Write a function which takes as a parameter a number which represents the dimensions of the flag. The flags will always be square, so the number 9 means you should make a flag measuring 9x9.
* It should return a *string* of the flag, with _'X' for the red/white lines and '-' for the blue background_. It should include newline characters so that it's not all on one line.
* For the sake of symmetry, treat odd and even numbers differently: odd number flags should have a central cross that is *only one 'X' thick*. Even number flags should have a central cross that is *two 'X's thick* (see examples below).

## Other points
* The smallest flag you can make without it looking silly is 7x7. If you get a number smaller than 7, simply _make the flag 7x7_.
* If you get a decimal, round it _UP to the next whole number_, e.g. 12.45 would mean making a flag that is 13x13.
* If you get something that's not a number at all, *return false*.

Translations and comments (and upvotes) welcome! 

![alt](http://i.imgur.com/1612YR3.jpg?1)

## Examples:
```python
union_jack(9) # (9 is odd, so the central cross is 1'X' thick)
"X---X---X
-X--X--X-
--X-X-X--
---XXX---
XXXXXXXXX
---XXX---
--X-X-X--
-X--X--X-
X---X---X"

union_jack(10) # (10 is even, so the central cross is 2 'X's thick)
'X---XX---X
-X--XX--X-
--X-XX-X--
---XXXX---
XXXXXXXXXX
XXXXXXXXXX
---XXXX---
--X-XX-X--
-X--XX--X-
X---XX---X

union_jack(1) # (the smallest possible flag is 7x7)
"X--X--X
-X-X-X-
--XXX--
XXXXXXX
--XXX--
-X-X-X-
X--X--X"

union_jack('string') #return false.
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def union_jack(n):
	

Solutions:
from math import ceil

def union_jack(n):
	if not isinstance(n, (int, float)):
		return False
	n = max(7, ceil(n))
	(h, m) = divmod(n - 1, 2)
	flag = [['X' if len({i, n - j - 1, j, h, h + m}) < 4 + m else '-' for i in range(n)] for j in range(n)]
	return '\n'.join((''.join(row) for row in flag))


import math

def union_jack(n):
	if type(n) not in [int, float]:
		return False
	if n < 7:
		n = 7
	n = math.ceil(n)
	x = '-' * (n // 2 - 1) + 'XX' + '-' * (n // 2 - 1) if n % 2 == 0 else '-' * (n // 2) + 'X' + '-' * (n // 2)
	tmp = list(x)
	(ans, n1) = ([], n // 2 if n % 2 != 0 else n // 2 - 1)
	for i in range(n1):
		t = tmp[:]
		t[i] = 'X'
		t[-i - 1] = 'X'
		ans.append(''.join(t))
	center = 'X' * n if n % 2 != 0 else 'X' * n + '\n' + 'X' * n
	return '\n'.join(ans + [center] + ans[::-1])


import math

def union_jack(n):
	if type(n) not in (int, float):
		return False
	n = max(7, math.ceil(n))
	ans = [['-'] * n for i in range(n)]
	for i in range(n):
		for j in range(n):
			if i == j or i + j == n - 1 or i in [n // 2, (n - 1) // 2] or (j in [n // 2, (n - 1) // 2]):
				ans[i][j] = 'X'
	return '\n'.join((''.join(i) for i in ans))


import math

def union_jack(n):
	if not isinstance(n, int) and (not isinstance(n, float)):
		return False
	n = max(7, math.ceil(n))
	m = n // 2 - 1 if n % 2 == 0 else (n - 1) // 2
	vertical = 'XX' if n % 2 == 0 else 'X'
	horizontal = 'X' * n + '\n' + 'X' * n if n % 2 == 0 else 'X' * n
	str = ''
	for i in range(m):
		s = ''
		for j in range(m):
			s += 'X' if i == j else '-'
		str += s + vertical + s[::-1] + '\n'
	return str + horizontal + str[::-1]


def union_jack(n):
	try:
		n = -min(-7, int(-n // 1))
	except:
		return False
	f = [['-X'[i == j or i == n - j - 1 or (n - 1) // 2 <= i <= n // 2 or ((n - 1) // 2 <= j <= n // 2)] for i in range(n)] for j in range(n)]
	return '\n'.join((''.join(l) for l in f))


from math import ceil

def union_jack(n):
	if not isinstance(n, int) and (not isinstance(n, float)):
		return False
	n = max(7, ceil(n))
	data = [['-'] * n for _ in range(n)]
	for y in range(n):
		data[y][y] = 'X'
		data[y][n - y - 1] = 'X'
	col_row = [n // 2] if n % 2 else [n // 2 - 1, n // 2]
	for cr in col_row:
		data[cr] = ['X'] * n
		for y in range(n):
			data[y][cr] = 'X'
	return '\n'.join((''.join(d) for d in data))


from math import ceil

def union_jack(size):
	if isinstance(size, int) or isinstance(size, float):
		n = max(ceil(float(size)), 7)
	else:
		return False
	jack = []
	for i in range(n):
		row = ['-'] * n
		row[(n - 1 + (not n % 2)) // 2] = row[(n - 1) // 2] = row[i] = row[n - 1 - i] = 'X'
		jack.append(''.join(row))
	jack[(n - 1) // 2] = jack[(n - 1 + (not n % 2)) // 2] = 'X' * n
	return '\n'.join(jack)