A `Nice array` is defined to be an array where for every value `n` in the array, there is also an element `n-1` or `n+1` in the array.

example:

```
[2,10,9,3] is Nice array because

2=3-1
10=9+1
3=2+1
9=10-1
```
Write a function named `isNice`/`IsNice` that returns `true` if its array argument is a Nice array, else `false`. You should also return `false` if `input` array has `no` elements.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Mathematics

Starter code: def is_nice(arr):
	

Solutions:
def is_nice(arr):
	s = set(arr)
	return bool(arr) and all((n + 1 in s or n - 1 in s for n in s))


def is_nice(arr):
	return all((x + 1 in arr or x - 1 in arr for x in arr)) and len(arr) > 0


def is_nice(arr):
	for x in arr:
		if x + 1 not in arr and x - 1 not in arr:
			return False
	return True and len(arr) > 0


is_nice = lambda l: l != [] and [e for e in l if e - 1 not in l and e + 1 not in l] == []


def is_nice(arr):
	if arr == []:
		return False
	else:
		for i in arr:
			if i + 1 not in arr:
				if i - 1 not in arr:
					return False
		return True


def is_nice(arr):
	return all((i + 1 in arr or i - 1 in arr for i in arr)) if arr else False


def is_nice(a):
	return all((e + 1 in a or e - 1 in a for e in a)) if a else False