A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are:

2332 
110011 
54322345

You'll be given 2 numbers as arguments: ```(num,s)```.  Write a function which returns an array of ```s``` number of numerical palindromes that come after ```num```. If ```num``` is a palindrome itself, it should be included in the count. 

Return "Not valid" instead if any one of the inputs is not an integer or is less than 0.

For this kata, single digit numbers will NOT be considered numerical palindromes. 

```
palindrome(6,4) => [11,22,33,44]
palindrome(59,3) => [66,77,88]
palindrome(101,2) => [101,111]
palindrome("15651",5) => "Not valid" 
palindrome(1221,"8") => "Not valid" 
```

```Haskell

In Haskell, the return type is a Maybe which returns Nothing if either of the inputs is negative."
```


Other Kata in this Series:
Numerical Palindrome #1
Numerical Palindrome #1.5 
Numerical Palindrome #2
Numerical Palindrome #3
Numerical Palindrome #3.5
Numerical Palindrome #4
Numerical Palindrome #5

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def palindrome(num,s):
	

Solutions:
def palindrome(num, s):
	if not type(num) == type(s) == int or num < 0 or s < 0:
		return 'Not valid'
	(ans, num) = ([], max(num, 11))
	while len(ans) != s:
		if num == int(str(num)[::-1]):
			ans.append(num)
		num += 1
	return ans


def palindrome(num, s):
	if not isinstance(num, int) or not isinstance(s, int) or num < 0 or (s < 0):
		return 'Not valid'
	lst = []
	while len(lst) < s:
		if str(num) == str(num)[::-1] and num > 9:
			lst.append(num)
		num += 1
	return lst


def palindrome(n, count):
	if not (isinstance(n, int) and isinstance(count, int)) or n < 0 or count < 0:
		return 'Not valid'
	result = []
	if n < 11:
		n = 11
	while count:
		s = str(n)
		if s == s[::-1]:
			result.append(n)
			count -= 1
		n += 1
	return result


def palindrome(num, s):
	if type(num) != int or type(s) != int or num < 0 or (s < 0):
		return 'Not valid'
	res = []
	i = max(11, num)
	while len(res) < s:
		if str(i) == str(i)[::-1]:
			res.append(i)
		i += 1
	return res


from itertools import count, islice

def palindrome(num, s):
	if isinstance(num, int) and isinstance(s, int) and (num > 0 <= s):
		palindromes = (x for x in count(max(num, 11)) if str(x) == str(x)[::-1])
		return list(islice(palindromes, s))
	return 'Not valid'


def palindrome(num, s):
	if isinstance(num, str) or num < 0 or isinstance(s, str) or (s < 0):
		return 'Not valid'
	t = []
	i = 1
	while i <= s:
		if pali(num):
			t.append(num)
			i += 1
		num += 1
	return t

def pali(n):
	if n > 10 and str(n) == str(n)[::-1]:
		return True
	return False


def palindrome(num, s):
	if type(num) is not int or type(s) is not int or num < 0 or (s < 0):
		return 'Not valid'
	result = []
	while s:
		if is_pal(num):
			result.append(num)
			s -= 1
			num += 1
		else:
			num += 1
	return result

def is_pal(n):
	return n > 10 and n == int(str(n)[::-1])


def palindrome(num, s):
	ispali = lambda n: str(n) == str(n)[::-1]
	if not isinstance(num, int) or num < 0 or (not isinstance(s, int)) or (s < 0):
		return 'Not valid'
	i = max(num, 10)
	ans = []
	while len(ans) < s:
		if ispali(i):
			ans.append(i)
		i += 1
	return ans


def palindrome(num, s):
	if type(123) != type(num) or type(123) != type(s):
		return 'Not valid'
	n = str(num)
	if any((not c.isdigit() for c in n)) or s < 0:
		return 'Not valid'
	R = []
	while len(R) < s:
		l = len(n)
		if num > 9 and all((a == b for (a, b) in zip(n[:l // 2], n[::-1]))):
			R.append(num)
		num += 1
		n = str(num)
	return R


def palindrome(n, s, r=[]):
	if not isinstance(n, int) or not isinstance(s, int) or n < 0 or (s < 0):
		return 'Not valid'
	while len(r) < s:
		(n, s, r) = (n + 1, s, r + [n] if str(n) == str(n)[::-1] and n > 9 else r)
	return r