For doing this, we can use the break statement like :for i in range(3): if i==1: break
for i in range(3):
if i==1:
break