It works very well but just doesn't work with case 4
p=[i for i in x if i in pw]
j=[i for i in t if i in pw]
if len(p)>=2 and len(j)>=2 and len(x)>=7:
Just an idea, maybe try set comprehension instead of list, in p and j.
Reason: If the same special character appears twice in the password, maybe it should only be counted once. I am not sure if the test cases cover this, though.