Python Exit While Loop With If Else Statement In C