Python Exit While Loop With If Statements In C