Sort by

recency

|

743 Discussions

|

  • + 0 comments

    pyp3 answer

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

  • + 0 comments

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

  • + 1 comment

    How come input 1 and 81 test case returns False, 81 is postive number and 1 is palindrome then it supposed to return True. My test case is failing as expected output is False for the above input 1 and 81 but my program returns True. Any suggestions?

  • + 0 comments

    My first submission used if __name__ in "__main__": as I was used to another system where that was a requirement in solution files or the test didn't run. The third line with the print was over 110 characters.

    Once I realized my line 1 wasn't required I got it down to two lines. Then I refined it further and renamed numbers to nums so second line would be less than 80 characters total.

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

    N = int(input())

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

    print(len(input_list)==N and all(x>=0 for x in input_list) and any(str(x)==str(x)[::-1] for x in input_list))