nested if statement in python questions