304 North Cardinal St.
Dorchester Center, MA 02124

# Any or All Hacker Rank Solution – Queslers

## Problem : Any or All Hacker Rank Solution

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
``````

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.

• 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.

### Any or All Hacker Rank Solution in python 2

``````# Enter your code here. Read input from STDIN. Print output to STDOUT
def is_pal(n):
S=str(n)
return all((s==t for s,t in zip(S,reversed(S))))
def meets_conditions(L):
if not all((l>0 for l in L)):
return False
return bool(any((is_pal(l) for l in L)))

N=int(raw_input())
L=map(int, raw_input().split())
print meets_conditions(L)``````

### Any or All Hacker Rank Solution in python 3

``````# Enter your code here. Read input from STDIN. Print output to STDOUT
N,n = int(input()),input().split()
print(all([int(i)>0 for i in n]) and any([j == j[::-1] for j in n]))
``````

### Any or All Hacker Rank Solution in pypy

``````# Enter your code here. Read input from STDIN. Print output to STDOUT
N,n = input(),raw_input().split()
print all([int(i)>0 for i in n]) and any([j == j[::-1] for j in n])
``````

### Any or All Hacker Rank Solution in pypy 3

``````# Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(input())
a = list(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')
``````
##### Any or All Hacker Rank Solution Review:

In our experience, we suggest you solve this Any or All Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Any or All is available on Hacker Rank for Free, if you are stuck anywhere between compilation, just visit Queslers to get all Hacker Rank Solution

##### Any or All Hacker Rank Solution Conclusion:

I hope this Any or All Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Hacker Rank Problem & Solutions >>

Mini-Max Sum Hacker Rank Solution

String Validators Hacker Rank Solution

Text Alignment Hacker Rank solution

String validators Hacker Rank Solution