### Python Coding Tips: Set & List

The following code snippets are very helpful during sets and list operations. Intersection of sets must check for valid case $ cat sets.py s1 = {1,2,3} s2 = {} # empty sets means the intersection is empty too! s3 = {} if set(s1) & set(s2): print(s1.intersection(s2)) else: print(“no intersection”) Result $ python sets.py no intersection … More Python Coding Tips: Set & List