nested if statement in python simple program