While Loop And If Statement Python Code