Python all any built-in function

I have been using Python for a long time, still learning lot of simple and new things. Recently I came to know about two built-in functions named all and any. Today while I was solving a hackerrank problem, I used both functions which makes the code a bit nicer, in my opinion.

The functions compares two singly linked lists and if they are equal, returns 1, otherwise returns 0. Here is my code –

def compare_lists(llist1, llist2):
while all([llist1, llist2]):
if !=...

Read the entire article at the source link… Tamim Shahriar

#codango #developer #development #coder #coding

We're happy to share this resource that we found. The content displayed on this page is property of it's original author and/or their organization.


Leave a Reply

Your email address will not be published. Required fields are marked *