This and the check on line 101 fail (index out of range) if there are no $ in the string. Perhaps the check could instead be:
`elif self.password.startswith("p5k2$"):`