x=0
while x<5:
print(x)
if x==2:
break
x+=1
x=0
while x<5:
if x==2:
break
print(x)
x+=1
these are the two codes i runned, in the 1st one I am getting answer: 0
1
2
and in 2nd one I am getting answer:0
1
why is it so, what is the reason that I am getting different results, is there any specific logic?
New contributor
mikey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.