What is better to use:

if var in X:
    #do_whatever
elif (var in Y):
    #do_whatever2

or:

if var in X:
    #do_whatever
if var in Y:
    #do_whatever2

Assuming var can't be in both X and Y... Is there any rule or common practice? Should I use elif? or a new if? or it doesn't matter??

EDIT: Great answers.. But can I say that if the first statement (#do_whatever) ends with a return or a break; where in its end the other condition will not be tested thus wasting the system resources or causing trouble, it's ok to do whatever.. I guess...

Edit
Report