any()

This expression returns True if any element of the iterable is true. 

If the iterable is empty, it will return False. 

Code

>>> any([1>0,1==0,1<0])
True
>>> any([1<0,2<1,3<2])
False

all()

This expression returns True if all of the elements of the iterable are true. If the iterable is empty, it will return True. 

Code  

>>> all(['a'<'b','b'<'c'])
True
>>> all(['a'<'b','c'<'b'])
False

Task

You are given a space separated list of integers. If all the integers are positive, then you need to check if any integer is a palindromic integer.

Input Format

The first line contains an integer $N$. $N$ is the total number of integers in the list. 

The second line contains the space separated list of $N$ integers.

Constraints

$0<N<100$

Output Format

Print True if all the conditions of the problem statement are satisfied. Otherwise, print False.

Sample Input
5
12 9 61 5 14 

Sample Output

True

Explanation

Condition 1: All the integers in the list are positive. 

Condition 2: 5 is a palindromic integer.

Hence, the output is True.

Can you solve this challenge in 3 lines of code or less? 

There is no penalty for solutions that are correct but have more than 3 lines.

Source: hackerrank | Difficulty: EASY


Solutions:
(_, l) = (input(), input().split())
print(any((x.startswith(tuple('0-')) for x in l)) < any((x == x[::-1] for x in l)))


input()
elem = list(input().split())
(print('True') if any((i == i[::-1] for i in elem)) else print('False')) if all((i[0] != '-' for i in elem)) else print('False')


(N, L) = (int(input()), list(input().split()))
print(all([all([False for x in L if int(x) < 0]), any([True for x in L if x == x[::-1]])]))


n = int(input().rstrip())
arr = [int(i) for i in input().rstrip().split(' ')]
print(any([str(i) == str(i)[::-1] for i in arr]) and all([i > 0 for i in arr]))


input()
l = [int(x) for x in input().split()]
print(all([x > 0 for x in l]) and any([True for x in l if str(x) == str(x)[::-1]]))


n = int(input())
nums = list(map(int, input().strip().split(' ')))
print(all(list(map(lambda x: x >= 0, nums))) and any(list(map(lambda x: list(str(x)) == list(reversed(str(x))), nums))))


input()
l = input().split()
print(all(map(lambda x: int(x) > 0, l)) and any(map(lambda x: all((x[i] == x[-i - 1] for i in range(len(x)))), l)))


i = int(input())
a = input().split()
print(all([int(x) > 0 for x in a]) and any([x == x[::-1] for x in a]))


n = int(input())
l = list(map(int, input().split(' ')))
print(all([x >= 0 for x in l]) and any([str(x) == str(x)[::-1] for x in l]))


input()
A = input().split()
if all((int(x) > 0 for x in A)) and any((x == x[::-1] for x in A)):
	print('True')
else:
	print('False')


(_, L) = (int(input()), input().strip().split())
print(all(map(lambda s: int(s) > 0, L)) and any(map(lambda s: s == s[::-1], L)))


(n, l) = (input(), list(input().split()))
print(all([int(x) > 0 for x in l]) and any([all([x[i] == x[-1 - i] for i in range(len(x) // 2 + 1)]) for x in l]))


(n, l) = (input(), [int(x) for x in input().split()])
print(all(map(lambda x: x >= 0, l)) and any(map(lambda x: str(x) == str(x)[::-1], l)))


input()
n = [int(x) for x in input().split()]
print(all([x >= 0 for x in n]) and any([str(x) == str(x)[::-1] for x in n]))


n = int(input())
x = list(map(int, input().split()))
a = 0
for i in x:
	if str(i) == str(i)[::-1]:
		a = 1
		break
print(all([min(x) >= 0, a == 1]))


n = int(input())
A = input().strip().split()
print(all([int(i) >= 0 for i in A]) and any([s == ''.join(reversed(s)) for s in A]))


N = int(input())
L = [int(_) for _ in input().split()]
print(all(map(lambda x: x > 0, L)) and any(map(lambda x: str(x) == str(x)[::-1], L)))


n = int(input())
ms = input().split()
print(all([all((int(x) > 0 for x in ms)), any((x == x[::-1] for x in ms))]))


n = input()
x = list(map(int, input().split()))
if all((i > 0 for i in x)):
	print(any((str(i) == str(i)[::-1] for i in x)))
else:
	print(False)


(n, numbers) = (int(input()), list(map(int, input().split())))
print(all((x >= 0 for x in numbers)) and any((x == int(str(x)[::-1]) for x in numbers)))


(N, l) = (int(input()), list(map(int, input().split())))
is_p = lambda x: x in (1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99)
print(all([e > 0 for e in l]) and any([is_p(e) for e in l]))


(N, arr) = (int(input().strip()), input().strip().split())
print(all([int(_) > 0 for _ in arr]) and any([_ == _[-1::-1] for _ in arr]))


N = int(input())
integers = list(map(int, input().split()))
print(all((i > 0 for i in integers)) and any((str(i) == str(i)[::-1] for i in integers)))


input()
arr = input().strip().split(' ')
print(all(map(lambda x: int(x) >= 0, arr)) and any(map(lambda x: x == x[::-1], arr)))


N = str(input())
L = list(map(int, input().split()))
print(all([x > 0 for x in L]) and any([str(x) == str(x)[::-1] for x in L]))


n = int(input())
lst = list(map(int, input().split()))
print(all((i > 0 for i in lst)) and any((str(i) == str(i)[::-1] for i in lst)))


n = int(input())
s = list(map(int, input().split()))
print(all(map(lambda x: x > 0, s)) and any(map(lambda x: str(x) == str(x)[::-1], s)))


def reversable(x):
	return x == x[::-1]

def positive(x):
	return x >= 0
input()
s = input().split()
i = map(int, s)
b = map(reversable, s)
print(any(b) and all(map(positive, i)))


n = int(input())
ar = list(map(int, input().split()))
ar = sorted(ar)
if ar[0] <= 0:
	print(False)
else:
	chk = False
	for i in ar:
		s = str(i)
		if s == s[::-1]:
			chk = True
			break
	print(chk)


n = int(input().strip())
data = list(map(int, input().strip().split()))
a = all(map(lambda x: x > 0, data))
b = any([all(map(lambda k, l: k == l, str(num), reversed(str(num)))) for num in data])
print(a & b)


numInput = int(input())
nums = input().split()
if all([int(x) > 0 for x in nums]):
	print(any([str(x) == str(x)[::-1] for x in nums]))
else:
	print('False')


(n, a) = (int(input()), list(input().split()))

def isPalin(n):
	return True if all([n[i] == n[len(n) - i - 1] for i in range(len(n))]) else False
print(True if all([int(x) > 0 for x in a]) and any([isPalin(x) for x in a]) else False)


i = int(input())
arr = list(map(int, input().split(' ')))
print(all([all(map(lambda x: x > 0, arr)), any(map(lambda x: str(x) == str(x)[::-1], arr))]))


def is_palindromic(x):
	str_ = list(str(x))
	str_.reverse()
	rev = int(''.join(str_))
	return x - rev == 0
N = int(input())
lst = list(map(int, input().split()))
if all(list(map(lambda x: x >= 0, lst))):
	if any(list(map(is_palindromic, lst))):
		print(True)
	else:
		print(False)
else:
	print(False)


n = int(input())
a = [inp for inp in input().split()]
print(all(list(map(lambda x: int(x) > 0, a))) and any(list(map(lambda x: int(x) == int(''.join(list(reversed(list(x))))), a))))


N = int(input())
iData = list(map(int, input().split()))
print(all([e > 0 for e in iData]) and any([str(e) == str(e)[::-1] for e in iData]))


n = input()
N = input().strip().split()
print(all(map(lambda x: int(x) >= 0, N)) and any(map(lambda x: x == x[::-1], N)))


n = int(input())
data = input().split(' ')
print(all(list(map(lambda x: eval(str(x) + '>=0'), data))) and any(list(map(lambda x: eval('str(x) == str(x)[::-1]'), data))))


(N, L) = (int(input()), input().split())
print(all([int(x) > 0 for x in L]) and any([x == x[::-1] for x in L]))


n = int(input())
v = list(map(int, input().split()))
print(all([x > 0 for x in v]) and any([str(x) == str(x)[::-1] for x in v]))


(n, nums) = (int(input()), input().split())
print(all((int(n) > 0 for n in nums)) and any((list(n) == list(reversed(n)) for n in nums)))


input()
l = input().split()
print(any(list(map(lambda x: x == x[::-1], l)))) if all(list(map(lambda x: int(x) > 0, l))) else print(False)


n = int(input())
ar = [int(a0) for a0 in input().split(' ')]
if all((a > 0 for a in ar)):
	ar = [str(a1) for a1 in ar]
	if any((a2 == a2[::-1] for a2 in ar)):
		print('True')
	else:
		print('False')
else:
	print('False')


(n, l) = (input(), list(map(int, input().split())))
print(len(l) == len(list(filter(lambda x: x > 0, l))) and 0 != len(list(filter(lambda x: str(x) == str(x)[::-1], l))))


input()

def i32(vs):
	return int(''.join(vs))
xs = input().split()
ys = [x > 0 for x in list(map(int, xs))]
if all(ys):
	print(any([i32(x) == i32(reversed(x)) for x in list(map(list, xs))]))
else:
	print(False)


input()
y = 'False'
a = map(int, input().split(' '))
for i in a:
	if all([i > 0]):
		if all([str(i) == str(i)[::-1]]):
			y = 'True'
	else:
		y = 'False'
print(y)


N = int(input())
List = [int(x) for x in input().strip().split()]
print(all(map(lambda x: x > 0, List)) and any(map(lambda x: str(x) == str(x)[::-1], List)))


N = int(input())

def check(x):
	return int(str(x)[::-1]) == x
numbers = list(map(int, input().split()))
print(min(numbers) > 0 and any([check(x) for x in numbers]))


import sys
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
print(all((x > 0 for x in A)) and any((str(x) == str(x)[::-1] for x in A)))


input()
a = list(map(int, input().split()))

def palindromic(x):
	if len(x) == 1:
		return True
	else:
		return x[:] == x[::-1]
if all((i > 0 for i in a)):
	print(any((palindromic(str(i)) for i in a)))
else:
	print(False)


a = input()
b = list(map(int, input().split()))
c = [list(str(x)) for x in b]
print(all([z > 0 for z in b]) and any([list(s) == list(reversed(s)) for s in c]))


_ = int(input())
n = list(map(int, input().split()))
r = all(map(lambda x: x > 0, n)) and any(map(lambda x: str(x)[::-1] == str(x), n))
print(r)


L = input() == 0 or [int(i) for i in input().split()]
print(all([i >= 0 for i in L]) and any([str(i) == ''.join(reversed(str(i))) for i in L]))


def ispalindrome(s):
	return all((s[i] == s[::-1][i] for i in range(len(s) // 2)))
input()
X = {int(x) for x in input().split()}
print(all((x > 0 for x in X)) and any((ispalindrome(str(x)) for x in X)))


N = int(input())
a = list(map(int, input().split()))
print(all((i > 0 for i in a)) and any((str(i) == str(i)[::-1] for i in a)))


from collections import deque
(garbage, nums) = (int(input()), list(map(int, input().split())))

def is_palindrome(x_):
	x = deque(str(x_))
	res = 1
	while x and res:
		try:
			res = x.pop() == x.popleft()
		except IndexError:
			pass
	return res
print(all([n > 0 for n in nums]) and any([is_palindrome(n) for n in nums]))


n = int(input())
a = tuple(map(int, input().split()))
print(all([x > 0 for x in a]) and any([str(x) == str(x)[::-1] for x in a]))


n = input()
l = input().split()
print(all((i[0] != '-' for i in l)) and any((i == i[::-1] for i in l)))


n = input()
l = list(map(int, input().split()))
print(all(map(lambda x: x > 0, l)) and any(map(lambda x: str(x) == str(x)[::-1], l)))


int(input())
n = input().split()
al = all(list(map(lambda x: int(x) > 0, n)))
an = any(list(map(lambda x: x[::-1] == x, n)))
print(al and an)


def main():
	n = int(input())
	s = list(map(int, input().strip().split()))
	if all([x >= 0 for x in s]):
		if any([x < 10 for x in s]):
			print(True)
			return
	print(False)
	return
main()


n = int(input())
inp = input()
print(all([x > 0 for x in map(int, inp.split())]) and any([x == x[::-1] for x in inp.split()]))


n = int(input())
s = input().split()
if all([int(x) > 0 for x in s]) and any([x == x[::-1] for x in s]):
	print(True)
else:
	print(False)


N = int(input())
s = input().split()
print(all([int(x) > 0 for x in s]) and any([y == y[::-1] for y in s]))


N = int(input())
nums = list(map(int, input().split()))
if all([i > 0 for i in nums]) == True:
	print(any([str(i) == str(i)[::-1] for i in nums]))
else:
	print(False)


input()
s = input().split()
print(all(list(map(lambda x: int(x) >= 0, s))) and any(list(map(lambda x: x == x[::-1], s))))


n = int(input())
dat = [int(x) for x in input().split(' ')]
print(all((e > 0 for e in dat)) and any((str(e) == str(e)[::-1] for e in dat)))


input()
lst = list(map(int, input().split()))
print(all([x > 0 for x in lst]) and any([str(x) == str(x)[::-1] for x in lst]))


def ispalin(i):
	return str(i) == str(i)[::-1]
n = int(input())
a = list(map(int, input().split()))
print(all((i > 0 for i in a)) and any((ispalin(j) for j in a)))


s = input() and input().split()
print(all((int(i) >= 0 for i in s)) and any((i == i[::-1] for i in s)))


n = int(input())
s = list(map(int, input().split()))
print(all((i > 0 for i in s)) and any((str(i) == str(i)[::-1] for i in s)))


N = int(input())
a = [int(i) for i in input().strip().split()]
is_positive = [True if i > 0 else False for i in a]
is_palindrome = [i for i in a if str(i) == str(i)[::-1]]
print(all(is_positive) and any(is_palindrome))


def main():
	n = int(input())
	l = input().split()
	print(len([i for i in l if int(i) >= 0]) == n and any([j for j in l if j == ''.join(reversed(j))]))
main()


n = int(input())
numbers = list(map(int, input().split()))
count = 0
count_palindrome = 0
for element in numbers:
	if element > 0:
		count += 1
for i in range(len(numbers)):
	string = str(numbers[i])
	counts = 0
	for j in range(len(string) // 2):
		if string[j] == string[-1 - j]:
			counts += 1
	if counts == len(string) // 2:
		count_palindrome += 1
if count_palindrome > 0 and count == len(numbers):
	print(True)
else:
	print(False)


n = int(input())
lst = list(map(int, input().strip().split()))
first = all(list(map(lambda x: x > 0, lst)))
snd1 = any(list(map(lambda x: x < 10, lst)))
snd2 = any(list(map(lambda x: x % 11 == 0, lst)))
print(all([first, any([snd1, snd2])]))


input()
n = list(map(int, input().split()))
result = all((i > 0 for i in n)) and any((str(i) == str(i)[::-1] for i in n))
print(result)


n = int(input())
l = input().split()
print(all([int(i) >= 0 for i in l]) and any([j for j in l if j == ''.join(reversed(j))]))


N = int(input())
A = input().split()
for r in A:
	if int(r) <= 0:
		print(False)
		break
else:
	for r in A:
		if r == r[::-1]:
			print(True)
			break
	else:
		print(False)


n = int(input())
data = list(map(int, input().split()))
print(all((x > 0 for x in data)) and any((x == int(str(x)[::-1]) for x in data)))


def ispal(n):
	s = list(str(n))
	t = [d for d in s]
	s.reverse()
	return s == t
N = int(input())
A = list(map(int, list(input().split(' '))))
print(all([a > 0 for a in A]) and any([ispal(a) for a in A]))


input()
integers = input().split()
print(all((int(n) > 0 for n in integers)) and any((n == n[::-1] for n in integers)))


def __starting_point():
	num_cnt = int(input().strip())
	arr = list(input().strip().split())
	print(all([all([int(x) > 0 for x in arr]), any([x == x[::-1] for x in arr])]))
__starting_point()


input()
numbers_list = [int(x) for x in input().split()]
print(all((x >= 0 for x in numbers_list)) and any((str(x) == str(x)[::-1] for x in numbers_list)))


n = int(input())
L = input().split()
print(all((int(item) >= 0 for item in L)) & any((item[::-1] == item for item in L)))


n = int(input())
lst = list(map(int, input().split()))

def is_palindrome(n):
	(result, div) = (0, n)
	while div != 0:
		(div, mod) = divmod(div, 10)
		result = result * 10 + mod
	return result == n
if any((i < 0 for i in lst)):
	print(False)
else:
	print(any((is_palindrome(i) for i in lst)))


input()
qwe = list(map(int, input().split()))
print(all([x > 0 for x in qwe]) & any([str(x) == str(x)[::-1] for x in qwe]))


N = int(input())
nums = input().split()
print(all([int(n) > 0 for n in nums]) and any([n[::-1] == n for n in nums]))


_ = input()
numbers = [int(n) for n in input().split()]
print(all((n > 0 for n in numbers)) and any((str(n) == str(n)[::-1] for n in numbers)))


(n, lis) = (int(input()), list(map(int, input().split())))
if all((val > 0 for val in lis)):
	if any((str(val) == str(val)[::-1] for val in lis)):
		print(True)
	else:
		print(False)
else:
	print(False)


n = int(input())
lista = list(map(int, input().split()))
print(all((x > 0 for x in lista)) and any((str(x) == str(x)[::-1] for x in lista)))


n = int(input())
l = input().split()
print(all((int(x) > 0 for x in l)) and any((x == x[::-1] for x in l)))


input()
ns = input().split()
print(all(map(lambda x: int(x) > 0, ns)) and any(map(lambda x: ''.join(reversed(list(str(x)))) == str(x), ns)))


n = int(input())
data = list(map(int, input().split()))
print(all((v > 0 for v in data)) and any((str(v) == str(v)[::-1] for v in data)))