if len(ps)>5 or len(ps)<13:
That expression will succeed if the length is any value greater than 5 (i.e. 6 to infinity), or any value less than 13 (i.e. 12 to minus infinity). The test should be for expression 1 AND expression 2:
if len(ps)>5 and len(ps)<13: