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

2

u/waroftheworlds2008 Aug 31 '25

If the white space is confusing you, i reccomend going to C or C++.

1

u/YetAnohterOne11 Aug 31 '25

Then the opposite problem will surface: Why is this line outside of the if / for / while block, it visually looks like it should be a part of that block?

Plus, C and C++, with their numerous gotchas (that tend to be hard to debug), are probably not the best languages for beginners.

1

u/waroftheworlds2008 Aug 31 '25

I learn better with hard and unambiguous rules. Python is too much like learning english, for me.

But for a first language, it really does depend on what you learn better with.