Skip to content

Please teach a question, https://www.hackerrank.com/challenges/any-or-all #86

@n-WN

Description

@n-WN

Please teach a question, any or all this question
My code will waive a case if I remove list()

n = int(input())

def palindromic(n):
    n = str(n)
    if n == n[::-1]:
        return True
    return False

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

is_palindromic = [palindromic(x) for x in a]
is_positive = [x >= 0 for x in a]

print(all(is_positive) and any(is_palindromic))

Also the last line of code is written after yours but I don't understand why it is written this way, I can easily do without these two functions, but if I have to use them, I don't understand how to handle it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions