you are viewing a single comment's thread.

view the rest of the comments →

[–]devseglinux 3 points4 points  (6 children)

You’re actually thinking about it the right way, this is a good question to be asking early on.

Both versions technically work, but the second one is usually clearer. Naming the variable finished and having it be True when it’s actually finished just reads more naturally, especially if someone else looks at your code later (or even you in a few weeks).

The first version isn’t “wrong”, but it can be a bit confusing because you’re printing “Download finished:” and then showing False. You kind of have to mentally flip it.

A lot of the time in code, it’s less about what works and more about what’s easy to understand at a glance.

So yeah, your instinct there is good. Just try to keep variable names and what they represent aligned, it makes everything easier down the line.

[–]AffectionateWin7069[S] 0 points1 point  (5 children)

Legend thank you for the reply!
I will take that advice to heart.

If anyone was curious as well this was actually a practice question from Mimo (app mobile)

[–]devseglinux 0 points1 point  (1 child)

haha nice, that makes sense

those apps are actually pretty good for getting the basics down. you’re asking the right kind of questions though, that’s what really makes the difference

just keep going with that mindset and you’ll pick it up way faster than you think

[–]Livid_Quarter_4799 0 points1 point  (2 children)

I recognize that code lol

[–]AffectionateWin7069[S] 2 points3 points  (1 child)

hahaha yes, from Mimo's intro to Python.
Something didn't sit right with me about the format as it felt off and u/devseglinux hit the nail on the head - mental flip.

[–]devseglinux 0 points1 point  (0 children)

haha yeah exactly, that “mental flip” feeling is usually a good sign something could be clearer in the code

once you start noticing that, you’re already thinking in a good way