How To Use For Loop With Condition In Python