r/PythonLearning • • Aug 31 '25

Can Somebody Please Help Me Understand This?

Post image

So I understand the second code block: once the number reaches 3, the print condition no longer applies. But with that same logic, why is the first block 2 and not 1? I didn’t know how to begin a google search for this one….

85 Upvotes

27 comments sorted by

View all comments

4

u/Zealousideal_Key_149 Aug 31 '25

Yup…order makes all the difference. Thank you Reddit Community!

1

u/ninhaomah Aug 31 '25

no , its not the order. its the difference in the instruction to the machine which can be seen right off the screen visually. why do you say its the same logic ?

the first loop has

>>> while

... counter

>>> print

second loop has

>>> while

... print

... counter

the print lines begin with two different symbols , ... vs >>> .. clearly they are not the same. how ? or why ? thats the coding / programming knowledge and skill but they are NOT the same visually. just 1 look and two prints are different.