Nested If Else Statement In Python Syntax For Loop